File tree Expand file tree Collapse file tree 2 files changed +42
-5
lines changed Expand file tree Collapse file tree 2 files changed +42
-5
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ from flask import Flask , request , jsonify
3
+ from pprint import pprint
4
+
5
+ app = Flask (__name__ )
6
+
7
+ @app .route ("/webhooks/answer" )
8
+ def answer_call ():
9
+ ncco = [
10
+ {
11
+ "action" : "talk" ,
12
+ "text" : "Hi, we will shortly forward your call. This call is recorded for quality assurance purposes."
13
+ },
14
+ {
15
+ "action" : "record" ,
16
+ "split" : "conversation" ,
17
+ "eventUrl" : ["https://demo.ngrok.io/webhooks/recordings" ]
18
+ },
19
+ {
20
+ "action" : "connect" ,
21
+ "eventUrl" : ["https://demo.ngrok.io/webhooks/event" ],
22
+ "from" : "NEXMO_NUMBER" ,
23
+ "endpoint" : [
24
+ {
25
+ "type" : "phone" ,
26
+ "number" : "RECIPIENT_NUMBER"
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ return jsonify (ncco )
32
+
33
+ @app .route ("/webhooks/recordings" , methods = ['POST' ])
34
+ def recordings ():
35
+
36
+ data = request .get_json ()
37
+ pprint (data )
38
+
39
+ if __name__ == '__main__' :
40
+ app .run (port = 3000 )
Original file line number Diff line number Diff line change @@ -13,11 +13,11 @@ def answer_call():
13
13
},
14
14
{
15
15
"action" : "record" ,
16
- "eventUrl" : ["https://275d6df0 .ngrok.io/webhooks/recordings" ]
16
+ "eventUrl" : ["https://demo .ngrok.io/webhooks/recordings" ]
17
17
},
18
18
{
19
19
"action" : "connect" ,
20
- "eventUrl" : ["https://275d6df0 .ngrok.io/webhooks/event" ],
20
+ "eventUrl" : ["https://demo .ngrok.io/webhooks/event" ],
21
21
"from" : "NEXMO_NUMBER" ,
22
22
"endpoint" : [
23
23
{
@@ -35,8 +35,5 @@ def recordings():
35
35
data = request .get_json ()
36
36
pprint (data )
37
37
38
- recording_url = request .args ['recording_url' ]
39
- pprint (recording_url )
40
-
41
38
if __name__ == '__main__' :
42
39
app .run (port = 3000 )
You can’t perform that action at this time.
0 commit comments