-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
653 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
Oops, something went wrong.