Skip to content

Commit

Permalink
add twilio example
Browse files Browse the repository at this point in the history
  • Loading branch information
benlower committed Oct 1, 2024
1 parent ff7124b commit df35d5b
Show file tree
Hide file tree
Showing 5 changed files with 653 additions and 0 deletions.
38 changes: 38 additions & 0 deletions examples/twilio-outgoing-call/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Twilio Outgoing Call Example

This example shows how to make an outgoing Ultravox call using Twilio.

### Installation
This project uses `pnpm`.

`pnpm install`

### Usage
1. **Create Ultravox Call** → Use the Ultravox API to [create a call](http://docs.ultravox.ai/api/calls/#create-call) and get a `joinUrl`.

*Note: you must set two additional parameters for the Twilio call in the request body:*

```javascript
{
...
"initiator": "agent",
"medium": { "twilio": {} }
}
```

You will use the new `joinUrl` in the next step.

2. **Env Variables** → Create a file called `.env` and add set the following variables

```
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_number
PHONE_NUMBER=phone_number_to_call
UV_JOIN_URL=ultravox_join_url
```

*Note: Phone numbers should include country code. E.g. for a US phone number it would look something like `+11234567890`*

3. **Run** → Make the call by running `pnpm dev`.

20 changes: 20 additions & 0 deletions examples/twilio-outgoing-call/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "twilio-outgoing-call",
"version": "0.0.1",
"description": "Makes an outgoing phone call using Ultravox and Twilio.",
"main": "app.ts",
"scripts": {
"dev": "npx ts-node src/app.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Fixie.ai",
"license": "MIT",
"dependencies": {
"@types/node": "^22.7.4",
"dotenv": "^16.4.5",
"ts-node": "^10.9.2",
"twilio": "^5.3.2",
"typescript": "^5.6.2"
}
}
Loading

0 comments on commit df35d5b

Please sign in to comment.