# xAI Grok Voice Agent

> Route an Edesy number to an xAI Grok Voice Agent over SIP - register the number with xAI, allowlist Edesy, save the Grok SIP URI as a destination, and test it.

Source: https://edesy.in/docs/sip-trunking/guides/xai-grok-voice-agent

To have an xAI Grok Voice Agent answer calls on your Edesy number, register the number with xAI in IP-allowlist mode with Edesy's signalling IP, save `sip:<number>@sip.voice.x.ai` in Edesy as a SIP destination, and route the number to it. Edesy forwards each incoming call to Grok, which runs the conversation.

> **Grok is not Groq.** Grok (xAI) is a hosted voice agent with its own SIP endpoint, covered here. Groq is an inference API with no telephony; to use Groq models, build an agent on LiveKit or Pipecat and connect it with [LiveKit Cloud](https://edesy.in/docs/sip-trunking/guides/livekit-cloud) or a [media stream](https://edesy.in/docs/sip-trunk-for-ai-voice-agents/connect/websocket-streaming).

## How it works

```
caller --> your Edesy number --SIP--> sip:<number>@sip.voice.x.ai --> Grok answers
```

xAI authenticates Edesy by source IP, so no credentials are stored on the Edesy side.

## Set it up

The **SIP** page in the Edesy portal has a **Wire x.ai (Grok) Voice Agent** card that generates these values for your number.

### 1. Allowlist Edesy on the xAI side

Register your Edesy number with xAI in IP-allowlist mode and add Edesy's signalling IP (shown in the portal card) to `allowed_addresses`:

```bash
curl https://api.x.ai/v1/realtime/numbers \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "number": "+91XXXXXXXXXX",
    "auth": { "allowed_addresses": ["<edesy-signalling-ip>"] },
    "webhook_url": "https://your-app.example.com/xai/incoming"
  }'
```

Store the webhook signing secret xAI returns. Check xAI's current SIP docs for the exact request.

### 2. Save Grok as a SIP destination

In **SIP → Inbound destinations → New destination**:

| Field | Value |
|---|---|
| Name | `My Grok agent` |
| SIP URI | `sip:+91XXXXXXXXXX@sip.voice.x.ai` |
| Transport | **Auto** |

Edesy sets the right transport for `sip.voice.x.ai` automatically, so leave Transport on Auto.

### 3. Route the number

On the number, set **Inbound routing** to **SIP URI** and pick `My Grok agent`.

### 4. Test

Click **Test call** on the destination. Edesy places a real call from one of your numbers to Grok, which proves Edesy can reach xAI, xAI accepts Edesy's IP, and the agent picks up. Then dial the number from a phone.

## FAQ

### Do I need a termination trunk for Grok?

Not for inbound calls. A trunk is only needed if a Grok agent should place outbound calls through Edesy; confirm with xAI that your setup supports trunk-based outbound first.

### Can I use SIP digest credentials with Grok instead of an IP allowlist?

Use IP-allowlist mode. Credentials toward Grok are not supported for this setup today.

### The test call fails straight away.

Usually Edesy's IP is missing from `allowed_addresses`, or the number in the URI does not match the number registered with xAI.

### Which codecs are used?

G.711, which Grok accepts. No transcoding settings are needed.
