|
1 | | -# Daily + Twilio SIP dial-out Voice Bot |
| 1 | +# Pipecat Bot → Daily SIP → Twilio Phone Number (Dial-out) |
2 | 2 |
|
3 | | -This project demonstrates how to create a voice bot that uses Daily's SIP capabilities with Twilio to make outbound calls to phone numbers. |
| 3 | +This example shows how a **Pipecat voice bot** can make outbound phone calls through **Daily's SIP infrastructure** to a **Twilio phone number**. The `provider="daily"` setting in the dial-out request tells Daily to use its own SIP servers for the media path. |
| 4 | + |
| 5 | +> **Using a Daily phone number instead of Twilio?** See the [`daily-pstn-dial-out`](../daily-pstn-dial-out) example — no Twilio SIP domain/TwiML configuration needed. However, Twilio has phone numbers in multiple regions. |
4 | 6 |
|
5 | 7 | ## How It Works |
6 | 8 |
|
7 | | -1. The server receives a dial-out request with the SIP URI to call |
8 | | -2. The server creates a Daily room with SIP capabilities |
9 | | -3. The server starts the bot process (locally or via Pipecat Cloud based on ENV) |
10 | | -4. The bot joins the room and initiates the dial-out to the specified SIP URI |
11 | | -5. Twilio receives the SIP request and processes it via configured TwiML |
12 | | -6. Twilio rings the number found within the SIP URI |
| 9 | +``` |
| 10 | +API Request (curl) → server.py → Spins up Pipecat Bot → Daily SIP dial-out → Twilio SIP Domain → Phone |
| 11 | +``` |
| 12 | + |
| 13 | +1. Your server receives a dial-out request with the SIP URI and `provider` |
| 14 | +2. The server creates a **Daily room** with dial-out enabled |
| 15 | +3. The server starts the Pipecat bot (locally or via Pipecat Cloud) |
| 16 | +4. The bot joins the room and initiates the dial-out (`provider="daily"`) |
| 17 | +5. **Daily's SIP** sends the call to your **Twilio SIP domain** |
| 18 | +6. Twilio processes the call via your TwiML bin or webhook handler and rings the destination number |
13 | 19 | 7. The bot automatically retries on failure (up to 5 attempts) |
14 | 20 | 8. When the call is answered, the bot conducts the conversation |
15 | 21 |
|
@@ -95,6 +101,8 @@ This example is organized to be production-ready and easy to customize: |
95 | 101 | - callerId must be a valid number that you own on [Twilio](https://console.twilio.com/us1/develop/phone-numbers/manage/incoming) |
96 | 102 | - answerOnBridge="true|false" based on your use-case |
97 | 103 | - Save the file. We will use this when creating the SIP domain |
| 104 | + |
| 105 | +note: `callerid` is hardcoded in the TwiML bin, to set it dynamically, the username field of the SIP URI can be overloaded to contain both the callerId and the destination number. `+1DESTINATION_+1CALLERID`. |
98 | 106 |
|
99 | 107 | 4. Create and configure a SIP domain |
100 | 108 |
|
@@ -171,7 +179,8 @@ You'll need two terminal windows open: |
171 | 179 | -H "Content-Type: application/json" \ |
172 | 180 | -d '{ |
173 | 181 | "dialout_settings": { |
174 | | - "sip_uri": "sip:+1234567890@daily.sip.twilio.com" |
| 182 | + "sip_uri": "sip:+1234567890@daily.sip.twilio.com", |
| 183 | + "provider": "daily" |
175 | 184 | } |
176 | 185 | }' |
177 | 186 | ``` |
@@ -269,3 +278,5 @@ agent_request = AgentRequest( |
269 | 278 | - Make sure both IP ACLs (0.0.0.0/1 and 128.0.0.0/1) are created and selected |
270 | 279 | - Verify that the TwiML bin has a valid caller ID from your Twilio account |
271 | 280 | - Check that the SIP domain name matches what you're using in the SIP URI |
| 281 | + |
| 282 | +Note: Setting Daily Provider come with the advantage of using Static IPs, which means you can set a smaller set of IP in the ACLs and have reliable SIP connectivity. |
0 commit comments