-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.py
More file actions
executable file
·56 lines (45 loc) · 1.19 KB
/
create.py
File metadata and controls
executable file
·56 lines (45 loc) · 1.19 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
import os
import uuid
import requests
# base url
auvious_url = os.environ['AUVIOUS_URL']
client_id = os.environ['CLIENT_ID']
client_secret = os.environ['CLIENT_SECRET']
application_id = os.environ['APPLICATION_ID']
r = requests.post(
f"{auvious_url}/security/oauth/token",
params={
'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret
}
)
access_token = r.json()['access_token']
# print(access_token)
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
r = requests.post(
f"{auvious_url}/rtc-api/conferences/create",
json={},
headers = headers
)
conference_id = r.json()['id']
r = requests.post(
f'{auvious_url}/security/ticket',
json={
'type': 'MULTI_USE_TICKET',
'ttl': 14400,
'length': 6,
'properties': {
'applicationId': application_id,
'conference_id': conference_id,
'customer_id': str(uuid.uuid4())
}
},
headers = headers)
ticket = r.json()['id']
print(f"Customer url: {auvious_url}/t/{ticket}")
print(f"Agent url: {auvious_url}/a?aid={application_id}&roomId={conference_id}")