1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32import nexmo
import json
from pprint import pprint
with open('caller/config/config.json', 'r') as config_file:
config = json.load(config_file)
with open('caller/config/private.key', 'r') as key_file:
private_key = key_file.read()
client = nexmo.Client(
application_id=config['APPLICATION_ID'],
private_key=private_key,
)
def make_call(number):
client.create_call({
'to': [
{
'type': 'phone',
'number': number
}
],
'from': {
'type': 'phone',
'number': config['NEXMO_NUMBER']
},
'answer_url': [
f'{config["SERVER"]}/calls/{number}.json'
]
})