๐Ÿ“ฆ wrussell1999 / royal-hackaway-v2

๐Ÿ“„ voice.py ยท 28 lines
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
28import nexmo
from pprint import pprint

from . import config

client = nexmo.Client(
    application_id=config.config['APPLICATION_ID'],
    private_key=config.private_key,
)

def make_call(number):
    server = config.config['SERVER']
    client.create_call({
        'to': [
            {
                'type': 'phone',
                'number': number
            }
        ],
        'from': {
            'type': 'phone',
            'number': config.config['NEXMO_NUMBER']
        },
        'answer_url': [
            f'{server}/calls/{number}.json'
        ]
    })