# IXHC RTC Twilio Phone Call Set-Up

### **Twilio phone call set-up**

1. Create an assistant and activate call/text with Realtime audio channel

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F3ozRWuveti9hGbG28ovD%2Fimage.png?alt=media&#x26;token=33c90e15-38af-497b-83d1-701127874b81" alt="" width="563"><figcaption></figcaption></figure>

2. Phone Number will get assigned to an assistant and wehook url will get configured for the phone number in Twilio

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2Fv3G89956wvldDRpyd2dC%2Fimage.png?alt=media&#x26;token=ce189c55-37de-4289-beb4-ed5f1f3cddd3" alt="" width="563"><figcaption></figcaption></figure>

3. Add SystemMessage for the assistant in studio mode

Note : Users can create their own prompts tailored to specific use cases. They can also design their custom call flows.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F0qnjFpEl9T41KzLP4NvY%2Fimage.png?alt=media&#x26;token=7c177b79-13df-4e19-9b7e-3a83612fddf6" alt=""><figcaption></figcaption></figure>

4. All Intents needs to be enabled for API-Access.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FtBRUA6CuFAanp77tMyzz%2Fimage.png?alt=media&#x26;token=2d330547-6406-4169-916c-22cc44713345" alt="" width="563"><figcaption></figcaption></figure>

5. Make sure Enable API Access is checked while publishing the app.
6. If the Twilio numbers are not configured, enable Twilio, and you will see list of phone number to choose from.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FV3miQTHog3JrZwK1tiCs%2Fimage.png?alt=media&#x26;token=6f3a788f-52d3-46c5-9440-aeb4c6e9af03" alt="" width="563"><figcaption></figcaption></figure>

7. Call the assigned Phone Number to test the Twilio phone call.

## Handle call disconnect/hangup in RTC

#### Step 1: Overview

This feature allows a Realtime Channel call to disconnect gracefully with a customizable goodbye message. It can trigger under two conditions:

* **30-60 Seconds of Silence (Configurable)**: Automatically disconnects if no activity is detected for 30-60 seconds.
* **Conversation Conclusion**: Disconnects upon receiving a 'bye' message from the model.

#### Step 2: Key Benefits

* **Enhanced User Experience**: Provides a smooth and considerate closure to conversations.
* **Customizability**: Allows setting a personalized goodbye message, enhancing interaction quality.
* **Efficiency**: Frees up resources by ending inactive calls promptly.

#### Step 3: Implementation&#x20;

By implementing this feature, we ensure efficient use of system resources while maintaining a positive and respectful user experience.

* **Silence for 30-60 Seconds**: If there is silence during a call for 30-60 seconds, the bot will:
  * Notify the user about disconnecting using a selected voice (OpenAI/ElevenLabs).
  * Use a pre-configured goodbye message if available.
  * Use a default message if no custom goodbye message is configured.
* **User-initiated Disconnection**:
  * The call disconnects within 1-5 seconds if the `hangup_call` tool is included in the bot's configuration when the user indicates they are done or unwilling to continue.
* **Continuous Interaction**:
  * The call remains active during interaction, preventing accidental disconnection.
* **No `hangup_call` Tool**:
  * Without the `hangup_call` tool configured, the bot will not disconnect the call between 1-5 secs, disconnects only after the configured 30-60 seconds.

#### Step 4: Configuration

* Hangup can be configured in the methods of a custom app, in the form of a system message or as a prompt.

{% hint style="info" %}
The user should exercise caution when using the `hangup_call` tool. It is essential to invoke the `hangup_call` prompt at the appropriate time according to the use case. Incorrect timing may result in the call being disconnected abruptly.

It is suggested to get users confirmation before invoking the hangup\_call tool.
{% endhint %}

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FJ7dCnF4vtb3x2uixnCCx%2Fimage.png?alt=media&#x26;token=658d7db9-bc69-49b7-9b1a-e64794011dcd" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FXzWY31FwpeHiqUuX0CEH%2Fimage.png?alt=media&#x26;token=9035e2db-757b-4edf-80b1-7fb3c7ecc376" alt=""><figcaption></figcaption></figure>

* The backend configuration for RTC, can be achieved in Basic Mode. We can configure managing **Call/Text Feature** in the ixHello platform by enabling the API access of the bot and by choosing the Audio channel to be Real Time.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2Fr76uPmaefyHT7AD0IhNy%2Fimage.png?alt=media&#x26;token=da73d491-a610-4ff1-81b8-dcf5c9abda48" alt="" width="563"><figcaption></figcaption></figure>

#### Sample Recording: &#x20;

{% file src="<https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FmT1m0EXJ3FfFGvGDmr4P%2FAUD-20251105-WA0006.m4a?alt=media&token=77abc3c2-0499-4c0b-bd3f-e2ae35949227>" %}

## No Answer/Silence Timeout

1. During a call with the bot, if there is no interaction for 30-60 seconds, the bot will respond with a selected voice (OpenAI/ElevenLabs) and announce the call's disconnection. It will use a default message ("I haven't heard from you, disconnecting the call now. Thank you for your time.") and Custom Goodbye message from bot configuration if its set. The call will not disconnect if there is interaction before the 30-60-second timeout.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FU3VILPmFBJ5xw8HPDdQB%2Fimage.png?alt=media&#x26;token=a61cc882-5147-4b31-aafb-b292034f7166" alt="" width="563"><figcaption></figcaption></figure>

#### Sample Recording:&#x20;

{% file src="<https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2Fsd7Mn0oWQGBmJ3r0IItE%2FAUD-20251105-WA0008.m4a?alt=media&token=548449ff-9ebb-486b-9398-ba3424767365>" %}
