---
title: "Connect an AI voice agent to Cloud SIP"
url: "https://enfonica.com/help/sip-trunking/connect-ai-voice-agent"
summary: "Send your phone number's incoming calls to the agent platform's SIP address over TLS, and give the platform your SIP domain with a username and password for outgoing calls. Use a SIP user rather than an IP list, because agent platforms call from addresses that change."
type: how-to
audience: everyone
products: ["Cloud SIP", "Phone Numbers", "Flow"]
works_with: ["ElevenLabs", "Other SIP-based voice AI platforms"]
who_can_do_this: "Whoever manages your Enfonica project and your agent platform"
---

# Connect an AI voice agent to Cloud SIP

**Short answer:** Send your phone number's incoming calls to the agent platform's SIP address over TLS, and give the platform your SIP domain with a username and password for outgoing calls. Use a SIP user rather than an IP list, because agent platforms call from addresses that change.

**Applies to:** Cloud SIP, Phone Numbers, Flow  
**Works with:** ElevenLabs, Other SIP-based voice AI platforms  
**Who can do this:** Whoever manages your Enfonica project and your agent platform

## Before you start

- An Enfonica project with a phone number for your agent.
- An account with an AI voice agent platform that can connect to a SIP trunk over TLS or UDP.
- The platform's SIP address for incoming calls, from its SIP trunk or phone number settings.

## How an AI voice agent connects to Cloud SIP

An AI voice agent platform, such as ElevenLabs, connects to Cloud SIP the same way a phone system does, in two directions. Set up the direction you need, or both.

| Direction | What you set up in Enfonica | What you give the platform |
| --- | --- | --- |
| Incoming calls, so callers reach your agent | Your phone number sends each call to the platform's SIP address over TLS | Your phone number in E.164 format |
| Outgoing calls and transfers, so your agent can call out | A SIP domain with a SIP user, set to send calls to the phone network | Your SIP domain, the transport, and the SIP user's username and password |

E.164 is the full international format for a phone number, such as `+61255501234`.

## Send incoming calls to your agent

Your phone number's incoming call handler forwards each call straight to the platform, so the caller's number reaches your agent unchanged.

1. In your agent platform, add your Enfonica phone number in E.164 format, for example `+61255501234`, and assign it to your agent. The platform uses the number to decide which agent answers.
2. Copy the platform's SIP address for incoming calls. Platforms call it the SIP server, SIP URI, or SIP endpoint, for example `sip.agents.example`.
3. In the [Enfonica Console](https://console.enfonica.com/), go to **Phone Numbers > My numbers**, and open the number.
4. Under **Call settings**, in **Incoming call handlers**, select **Add**, and then select **SIP**.
5. Select **SIP URI**, and enter the platform's address with TLS, for example `sip:sip.agents.example;transport=tls`. Leave out the part before the `@`. Cloud SIP fills in the number that was called, in E.164 format.
6. If the number has another handler from before, delete it. To keep your phone system as a fallback, use Flow instead. To learn how, see [Answer with your agent first, then your team](https://enfonica.com/help/sip-trunking/connect-ai-voice-agent#agent-first-then-your-team).
7. Select **Save Changes**.

Cloud SIP connects over TLS (port 5061) or UDP (port 5060). It doesn't support SIP over TCP, so choose TLS whenever the platform offers it. With TLS, Cloud SIP also offers encrypted call audio (SRTP). If the platform requires encrypted audio, add `;secure=true` to the address.

> **Tip:** If the platform asks which addresses your carrier calls from, give it Enfonica's two signaling addresses, `34.87.239.197` and `34.87.254.143`. If it asks your carrier for a username and password instead, add them to the address, for example `sip:sip.agents.example;transport=tls;username=enfonica;password=your-password`.

## Let your agent make outgoing calls

The platform sends outgoing calls to your SIP domain, which is your trunk on Enfonica. Every call carries a username and password that proves it's yours.

1. In the Console, go to **Cloud SIP**, and open your SIP domain. Or, to create one, select **New SIP domain**, and create a **Standard** SIP domain. A separate SIP domain for your agent keeps its settings apart from your phone system's.
2. Under **Termination settings**, set **Call termination mode** to **PSTN Trunk**, so that calls go to the phone network.
3. Under **Users**, select **Add user**.
4. Enter a username. For the password, enter at least 12 characters with uppercase letters, lowercase letters, and digits, or select **Generate**.
5. Keep a copy of the password, and then select **Add**.
6. Under **IP access control list**, delete any IP ranges.
7. Select **Save Changes**. Changes take effect within about a minute.

> **Warning:** When a SIP domain has both an IP access control list and users, every call must come from a listed network and carry the password. Agent platforms call from cloud servers whose addresses change. Their calls are refused with [403 Forbidden](https://enfonica.com/help/sip-errors/403-forbidden) until you remove the IP ranges, so use the username and password on their own.

Next, enter these values in the platform's outbound SIP trunk settings.

| Platform setting | Value |
| --- | --- |
| Address (SIP server, termination URI, or host) | Your SIP domain, for example `example.sip.enfonica.com` |
| Transport | TLS (port 5061), or UDP (port 5060). Not TCP |
| Username | The username on its own, for example `agent`, not `agent@example.sip.enfonica.com` |
| Password | The password you created for that user |
| Caller ID (from number) | Your agent's Enfonica number in E.164 format, for example `+61255501234` |
| Registration | Off. Cloud SIP checks the password on each call instead |
| Custom SIP headers | None needed |

Numbers your agent dials work best in E.164 format too. National format, such as `0255501234`, is also accepted. To learn how to send 13, 1300, and international numbers, see [Which number format should my PBX use?](https://enfonica.com/help/sip-trunking/number-formats)

## Transfer calls from your agent to a person

Choose a transfer type that makes a new call and joins the two calls together. Cloud SIP doesn't support SIP REFER transfers, so a REFER from the platform is refused with [405 Method Not Allowed](https://enfonica.com/help/sip-errors/405-method-not-allowed).

In ElevenLabs, set the transfer rule's **Transfer Type** to **Conference**, which is the default. The platform then places a second call to the person through your outgoing trunk, connects the caller, and leaves the call. Other platforms have a similar option, often called a conference, bridge, or warm transfer.

Transfers work only after you set up outgoing calls, as described in the previous section. Each transfer is an outgoing call, so it counts toward your plan's outgoing channels. For more information, see [Some calls fail when you're busy](https://enfonica.com/help/call-troubleshooting/calls-fail-when-busy).

## Answer with your agent first, then your team

To have your agent answer first, with your team as the fallback, route the call in Enfonica, not in your phone system. When a phone system forwards a call out to an agent, many show your number instead of the caller's. Routing in Flow keeps the original caller ID.

1. In the Console, select **Flow**, and create a new flow.
2. Drag a **Call** step under **When a call is received**.
3. Under **Recipients**, select **Add recipient**, and then select **Add SIP URI**.
4. Enter the agent's SIP URI, for example `sip:sip.agents.example;transport=tls`.
5. Add a second recipient the same way, with your phone system's load balancer, for example `sip:pbx@example.sip.enfonica.com`. For more information about load balancers, see [Send incoming calls to more than one PBX or site](https://enfonica.com/help/sip-trunking/load-balancing-failover).
6. Under **Advanced controls**, make sure that **Strategy** is **Linear**, which tries the recipients in order.
7. To reach your team sooner when the agent doesn't answer, lower the **Ring time**.
8. Select **Publish**.
9. Go to **Phone Numbers > My numbers**, and open the phone number.
10. Replace the number's handler with **Flow**, select your flow, and then select **Save Changes**.

Your phone system now receives these calls only when the agent doesn't answer. Make sure that it doesn't forward them back to the agent.

## Check that it worked

1. Call your number from a mobile. Your agent answers.
2. In the Console, go to **Cloud Voice > Calls**, and open the call. Its **SIP Insights** show each message between Cloud SIP and the platform. To learn how to read them, see [Find a call and read its SIP trace](https://enfonica.com/help/call-troubleshooting/find-call-sip-trace).
3. Have your agent call your mobile. Your mobile rings and shows the agent's number.
4. Ask the agent to transfer you. The person you transfer to answers, and the agent leaves the call.

If an outgoing call fails, its response code points to the cause:

- **403**. The username, password, or IP list.
- **405**. A REFER transfer or a registration attempt.
- **484**. The caller ID or the number dialed.

For each code and its fix, see [Outbound calls aren't going through](https://enfonica.com/help/call-troubleshooting/outbound-calls-fail).

## Questions

### Why use a username and password instead of an IP allow list?

Agent platforms run on cloud servers, so the address an outgoing call comes from can change from one call to the next. A username and password works from any address, and Cloud SIP checks it on every call. Keep an IP access control list for phone systems with a fixed public IP address.

### My platform says to register the trunk. Do I need to?

No. Cloud SIP doesn't use SIP registration, and a registration attempt is refused with `405 Method not allowed`. Leave registration off. Outgoing calls carry the username and password on each call, and incoming calls go to the SIP address you set on your phone number.

### Can I connect several agents?

Yes. Give each agent its own phone number in the platform, and point each number's handler at the platform. One SIP user can carry outgoing calls for all of them. To keep their credentials separate, create one user per agent.

### Can I build my own voice agent on Enfonica?

Yes. With the VoiceML `<Stream>` action, Cloud Voice can stream a call's audio to and from your own application in near real time. See [VoiceML Stream](https://enfonica.com/docs/cloud-voice/voiceml/stream/) in the developer docs.

## What to send us

Include these and we can find the call straight away.

- The number that made the call and the number it called, in full international format (for example +61255501234).
- The date and time of the call, with your timezone.
- Whether the call was inbound or outbound.
- The call ID, if the Console shows the call.
- What happened: an error message, silence, a busy tone or a dropped call.

[Contact support](https://enfonica.com/contact-support?article=%2Fhelp%2Fsip-trunking%2Fconnect-ai-voice-agent&topic=call-fault)

## Related

- [Connect your PBX to Cloud SIP](https://enfonica.com/help/sip-trunking/connect-pbx-to-cloud-sip.md)
- [Which number format should my PBX use?](https://enfonica.com/help/sip-trunking/number-formats.md)
- [Outbound calls aren't going through](https://enfonica.com/help/call-troubleshooting/outbound-calls-fail.md)
- [SIP 405 Method Not Allowed](https://enfonica.com/help/sip-errors/405-method-not-allowed.md)
- [SIP URIs: transport, encryption and credentials (docs)](https://enfonica.com/docs/cloud-sip/sip-uris/)
- [Making outgoing calls with Cloud SIP (docs)](https://enfonica.com/docs/cloud-sip/making-calls/)

---

Web version: https://enfonica.com/help/sip-trunking/connect-ai-voice-agent
