Skip to content

Commit 18e57e9

Browse files
author
Tony Bedford
committed
New building block, plus fixed view response code (was missing).
1 parent d5c0adf commit 18e57e9

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

voice/record-a-call-with-split-audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def answer_call():
3232

3333
@app.route("/webhooks/recordings", methods=['POST'])
3434
def recordings():
35-
3635
data = request.get_json()
3736
pprint(data)
37+
return ("200")
3838

3939
if __name__ == '__main__':
4040
app.run(port=3000)

voice/record-a-call.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ def answer_call():
3131

3232
@app.route("/webhooks/recordings", methods=['POST'])
3333
def recordings():
34-
3534
data = request.get_json()
3635
pprint(data)
36+
return ("200")
3737

3838
if __name__ == '__main__':
3939
app.run(port=3000)

voice/record-a-conversation.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python3
2+
# `eventMethod` is a required workaround currently, otherwise `/webhooks/recordings` is never called.
3+
from flask import Flask, request, jsonify
4+
from pprint import pprint
5+
6+
app = Flask(__name__)
7+
8+
@app.route("/webhooks/answer")
9+
def answer_call():
10+
ncco = [
11+
{
12+
"action": "talk",
13+
"text": "Hi, welcome to this Nexmo conference call. This call is recorded for quality assurance purposes."
14+
},
15+
{
16+
"action": "conversation",
17+
"name": "nexmo-conference-standard",
18+
"record": "true",
19+
"eventMethod": "POST",
20+
"eventUrl": ["https://demo.ngrok.io/webhooks/recordings"]
21+
}
22+
]
23+
return jsonify(ncco)
24+
25+
@app.route("/webhooks/recordings", methods=['POST'])
26+
def recordings():
27+
data = request.get_json()
28+
pprint(data)
29+
return ("200")
30+
31+
32+
if __name__ == '__main__':
33+
app.run(port=3000)

0 commit comments

Comments
 (0)