File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Import dependencies
2
+ import nexmo
3
+ import os
4
+ from os .path import join , dirname
5
+ from dotenv import load_dotenv
6
+
7
+ # Load the environment
8
+ envpath = join (dirname (__file__ ), './.env' )
9
+ load_dotenv (envpath )
10
+
11
+ # Init the client
12
+ print (os .getenv ("NEXMO_PRIVATE_KEY" ))
13
+ client = nexmo .Client (
14
+ application_id = os .getenv ('NEXMO_APPLICATION_ID' ),
15
+ private_key = os .getenv ("NEXMO_PRIVATE_KEY" )
16
+ )
17
+
18
+ response = client .create_call ({
19
+ "to" : [{"type" : "phone" , "number" : os .getenv ('TO_NUMBER' )}],
20
+ "from" : {"type" : "phone" , "number" : os .getenv ('FROM_NUMBER' )},
21
+ "ncco" : [
22
+ {
23
+ "action" : "talk" ,
24
+ "text" : "This is just a text whilst you tranfer to another NCCO"
25
+ }
26
+ ]
27
+ })
28
+
29
+ response = client .update_call (
30
+ response ["uuid" ], {
31
+ "action" : "transfer" ,
32
+ "destination" : {
33
+ "type" : "ncco" ,
34
+ "ncco" : [{"action" : "talk" , "text" : "hello world" }]
35
+ }
36
+ }
37
+ )
38
+
39
+
40
+ print (response )
You can’t perform that action at this time.
0 commit comments