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

# Twilio Programmable Voice / TwiML

> Transfer Twilio Programmable Voice calls to a Guava agent using TwiML

export const TLDR = ({children}) => <Card title="At a Glance">
    {children}
  </Card>;

<Tip>
  **Looking for Twilio Elastic SIP?** Check out our [guide here](/guides/twilio-elastic-sip).
</Tip>

If you already use Twilio Programmable Voice / TwiML, you can transfer to a Guava agent at any time during your call.

<TLDR>
  1. Create a Guava SIP code "guavasip-xxx" [on the Guava dashboard](https://app.goguava.ai/dashboard/sip).
  2. Attach an agent to the SIP code.
  3. Use the following TwiML template to transfer to your agent.

  ```xml theme={null}
  <Response>
      <Dial>
        <Sip>sip:guavasip-xxx@sip.goguava.ai</Sip>
      </Dial>
  </Response>
  ```
</TLDR>

## Create a Guava SIP code

Every SIP integration in Guava requires a `guavasip` code. `guavasip` codes are used to route inbound calls to agents — agents can listen to codes and peers dial them.

Open the [SIP page in the Guava dashboard](https://app.goguava.ai/dashboard/sip) and click **Create SIP Code**.

<Frame>
  <img src="https://mintcdn.com/guava-aac4ac05/9Nr_o-lNRt0dv0mX/images/sip-dashboard.png?fit=max&auto=format&n=9Nr_o-lNRt0dv0mX&q=85&s=b3016a73313e7ba563b34a8318cac900" alt="Guava SIP dashboard" width="2978" height="1742" data-path="images/sip-dashboard.png" />
</Frame>

Take note of the SIP code and the termination URI.

## Start an agent

Next, start an agent using `agent.listen_sip("guavasip-xxx")` — Guava forwards every call addressed to that code to your agent.

```python main.py theme={null}
import os

agent = guava.Agent(
    name="Nova",
    organization="Acme Corp",
)

# Register handlers — on_call_received, on_call_start, etc.

# Replace with your SIP code from the dashboard.
agent.listen_sip("guavasip-xxx")
```

## Twilio Example: Outbound Call

Initiate an outbound call through Twilio, then use a `Dial` command to transfer the call to your Guava agent using the termination URI.

```python twilio_outbound.py theme={null}
import os
from twilio.rest import Client

client = Client(
    os.environ["TWILIO_ACCOUNT_SID"],
    os.environ["TWILIO_AUTH_TOKEN"]
)

client.calls.create(
    to="+1...", # The recipient of the call.
    from_="+1...", # Your owned Twilio number.
    twiml="<Response><Dial><Sip>sip:guavasip-xxx@sip.goguava.ai</Sip></Dial></Response>",
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.