Skip to content

Commit 5e6ea22

Browse files
committed
Add Twilio websocket
1 parent 20721b5 commit 5e6ea22

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/index.py

+10
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,18 @@ def answer_call():
4848
print(4)
4949
response.play('https://demo.twilio.com/docs/classic.mp3')
5050
print(5)
51+
# Use <Record> to record the caller's message
52+
response.record()
53+
print(6)
54+
# End the call with <Hangup>
55+
response.hangup()
56+
print(7)
5157
return str(response)
5258

59+
@app.get("/webhook/voice")
60+
def record():
61+
answer_call()
62+
5363
@app.websocket("/stream")
5464
async def websocket_endpoint(websocket: WebSocket):
5565
await websocket.accept()

0 commit comments

Comments
 (0)