Skip to content

Commit e3cff1b

Browse files
authored
chore: simplify chime guide (#993)
1 parent 1ce08a8 commit e3cff1b

File tree

1 file changed

+20
-140
lines changed

1 file changed

+20
-140
lines changed

fern/advanced/sip/sip-chime.mdx

Lines changed: 20 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ slug: advanced/sip/amazon-chime
66

77
This guide walks you through setting up both outbound and inbound SIP trunking between Amazon Chime SDK and Vapi using a Voice Connector.
88

9+
This is a **Voice Connector-only** integration — inbound and outbound calls work with no Lambda functions or custom logic required. Vapi handles the AI assistant entirely. This approach is best for straightforward AI assistants on a phone number where no additional integration is needed.
10+
11+
<Note>
12+
This integration does not support passing custom SIP headers, metadata, or enriched escalation data (e.g., human transfer with SIP header context). For those use cases, use a **SIP Media Application** with **CallAndBridge** instead.
13+
</Note>
14+
915
## Prerequisites
1016

1117
- An AWS account with access to the [Amazon Chime SDK console](https://console.aws.amazon.com/chime-sdk/)
@@ -180,20 +186,16 @@ curl -X POST https://api.vapi.ai/call/phone \
180186

181187
</Steps>
182188

183-
## Inbound calls (Vapi to Chime SDK)
189+
## Inbound calls (Chime SDK to Vapi)
184190

185-
For inbound calls, a caller dials your Chime SDK phone number. The call flows through a SIP Rule, SIP Media Application, and Lambda function that bridges the call to Vapi via the Voice Connector:
191+
For inbound calls, a caller dials your Chime SDK phone number. The Voice Connector routes the call to Vapi through its origination settings — no Lambda or SIP Media Application required:
186192

187193
```mermaid
188194
graph LR
189195
A[Caller] --> B[Chime Phone Number]
190-
B --> C[SIP Rule]
191-
C --> D[SIP Media Application]
192-
D --> E[Lambda]
193-
E --> F[CallAndBridge]
194-
F --> G[Voice Connector]
195-
G --> H[sip.vapi.ai]
196-
H --> I[Vapi AI Assistant]
196+
B --> C[Voice Connector]
197+
C --> D[sip.vapi.ai]
198+
D --> E[Vapi AI Assistant]
197199
```
198200

199201
### Vapi configuration
@@ -240,7 +242,7 @@ Save the returned `id` — this is your **Credential ID** used in the following
240242

241243
<Step title="Register a phone number and assign your assistant">
242244

243-
Register a SIP phone number in Vapi, linking it to the credential and your assistant.
245+
Register your Chime SDK phone number in Vapi, linking it to the credential and your assistant:
244246

245247
```bash
246248
curl -X POST https://api.vapi.ai/phone-number \
@@ -249,17 +251,16 @@ curl -X POST https://api.vapi.ai/phone-number \
249251
-d '{
250252
"provider": "byo-phone-number",
251253
"name": "Chime SDK Number",
252-
"number": "YOUR_SIP_USERNAME",
253-
"numberE164CheckEnabled": false,
254+
"number": "YOUR_CHIME_PHONE_NUMBER",
255+
"numberE164CheckEnabled": true,
254256
"credentialId": "YOUR_CREDENTIAL_ID",
255257
"assistantId": "YOUR_ASSISTANT_ID"
256258
}'
257259
```
258260

259-
<Note>
260-
The SIP username can be any string — it does not need to be a phone number. This value becomes the user portion of the SIP URI that the Voice Connector sends calls to.
261-
</Note>
262-
261+
<Warning>
262+
The `number` field must exactly match the E.164 phone number assigned to your Voice Connector (e.g., `+18312168445`). Inbound calls will fail to route if the numbers don't match.
263+
</Warning>
263264

264265
</Step>
265266

@@ -269,27 +270,13 @@ The SIP username can be any string — it does not need to be a phone number. Th
269270

270271
<Steps>
271272

272-
<Step title="Provision a phone number">
273-
274-
In the AWS Chime SDK console, go to **Phone Number Management** and either provision a new phone number or update an existing one.
275-
276-
Set the **Product type** to **SIP Media Application Dial-In**.
277-
278-
![Update Phone Number](../../static/images/sip/sip-chime-update-phone-number.png)
279-
280-
<Warning>
281-
If the phone number is already assigned to a Voice Connector, you must first unassign it and save before changing the product type.
282-
</Warning>
283-
284-
</Step>
285-
286273
<Step title="Configure origination on the Voice Connector">
287274

288275
Navigate to your Voice Connector's **Origination** tab and set **Origination status** to **Enabled**.
289276

290277
![Enable Origination](../../static/images/sip/sip-chime-enable-origination.png)
291278

292-
Click **New** to add an inbound route pointing to Vapi's SIP server so the Voice Connector knows where to send outbound SIP INVITEs:
279+
Click **New** to add an inbound route pointing to Vapi's SIP server:
293280

294281
- **Host:** `YOUR_CREDENTIAL_ID.sip.vapi.ai`
295282
- **Port:** `5061` (for encrypted connections)
@@ -299,118 +286,11 @@ Click **New** to add an inbound route pointing to Vapi's SIP server so the Voice
299286

300287
</Step>
301288

302-
<Step title="Create the Lambda function">
303-
304-
This Lambda handles inbound call events from the SIP Media Application and bridges the call to Vapi via the Voice Connector.
305-
306-
Create a new Lambda function (**Node.js 18.x** or later) in the **same region** as your Chime SDK resources:
307-
308-
```javascript title="index.mjs"
309-
exports.handler = async (event) => {
310-
console.log("Event:", JSON.stringify(event, null, 2));
311-
312-
const eventType = event.InvocationEventType;
313-
314-
switch (eventType) {
315-
case "NEW_INBOUND_CALL":
316-
return handleNewCall(event);
317-
318-
case "ACTION_SUCCESSFUL":
319-
console.log("Action successful:", event.ActionData?.Type);
320-
return { SchemaVersion: "1.0", Actions: [] };
321-
322-
case "ACTION_FAILED":
323-
console.log("Action failed:", JSON.stringify(event.ActionData));
324-
return {
325-
SchemaVersion: "1.0",
326-
Actions: [{ Type: "Hangup", Parameters: { SipResponseCode: "503" } }],
327-
};
328-
329-
case "HANGUP":
330-
console.log("Call ended");
331-
return { SchemaVersion: "1.0", Actions: [] };
332-
333-
default:
334-
console.log("Unhandled event:", eventType);
335-
return { SchemaVersion: "1.0", Actions: [] };
336-
}
337-
};
338-
339-
function handleNewCall(event) {
340-
const callerNumber = event.CallDetails.Participants[0].From;
341-
342-
const voiceConnectorArn =
343-
"arn:aws:chime:REGION:ACCOUNT_ID:vc/YOUR_VOICE_CONNECTOR_ID";
344-
345-
const vapiSipUser = "YOUR_UNIQUE_USERNAME";
346-
347-
return {
348-
SchemaVersion: "1.0",
349-
Actions: [
350-
{
351-
Type: "CallAndBridge",
352-
Parameters: {
353-
CallTimeoutSeconds: 30,
354-
CallerIdNumber: callerNumber,
355-
Endpoints: [
356-
{
357-
BridgeEndpointType: "AWS",
358-
Arn: voiceConnectorArn,
359-
Uri: vapiSipUser,
360-
},
361-
],
362-
},
363-
},
364-
],
365-
};
366-
}
367-
```
368-
369-
Replace the following placeholders:
370-
- `REGION` — your AWS region (e.g., `us-west-2`)
371-
- `ACCOUNT_ID` — your AWS account ID
372-
- `YOUR_VOICE_CONNECTOR_ID` — your Voice Connector ID
373-
- `YOUR_UNIQUE_USERNAME` — the SIP username you configured in the Vapi phone number step
374-
375-
The `Uri` field is the user portion of the SIP request. The Voice Connector sends the INVITE to the origination host (`sip.vapi.ai`) with this value as the user, resulting in `sip:YOUR_UNIQUE_USERNAME@YOUR_CREDENTIAL_ID.sip.vapi.ai`.
376-
377-
<Note>
378-
The Lambda needs no special Chime SDK permissions — the SMA invokes it directly. Ensure the execution role has **AWSLambdaBasicExecutionRole** for CloudWatch logging.
379-
</Note>
380-
381-
</Step>
382-
383-
<Step title="Create the SIP Media Application">
384-
385-
In the Chime SDK console, go to **SIP media applications** and create a new one. Enter a name and the **Lambda function ARN** from the previous step.
386-
387-
![Create SIP Media Application](../../static/images/sip/sip-chime-create-sip-media-application.png)
388-
389-
Note the returned **SIP Media Application ID**.
390-
391-
</Step>
392-
393-
<Step title="Create the SIP Rule">
394-
395-
The SIP rule connects your provisioned phone number to the SIP Media Application. When a call arrives at your phone number, Chime invokes the SMA, which triggers the Lambda, which bridges the call to Vapi.
396-
397-
In the Chime SDK console, go to **SIP rules** and create a new one:
398-
399-
- **Trigger type:** To phone number
400-
- **Phone number:** Select your provisioned number
401-
- **SIP media application:** Select the SMA you created
402-
403-
![Create SIP Rule](../../static/images/sip/sip-chime-create-sip-rule.png)
404-
405-
</Step>
406-
407289
<Step title="Test the integration">
408290

409-
Call your Chime SDK phone number from any phone.
291+
Call your Chime SDK phone number from any phone. The call routes through the Voice Connector's origination settings to `sip.vapi.ai`, where your Vapi assistant answers.
410292

411-
To debug issues:
412-
- Check **CloudWatch Logs** for the Lambda function to see event payloads and errors.
413-
- Enable **SIP logging** on the Voice Connector (under the **Logging** tab) for detailed SIP message traces.
293+
To debug issues, enable **SIP logging** on the Voice Connector (under the **Logging** tab) for detailed SIP message traces.
414294

415295
</Step>
416296

0 commit comments

Comments
 (0)