Created
November 27, 2018 13:30
-
-
Save sboily/6ce08f93afe011004bb23483ae39e60b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from xivo_auth_client import Client as Auth | |
from wazo_websocketd_client import Client | |
username = "" | |
password = "" | |
host = "" | |
events = [ | |
'call_created', | |
'call_ended' | |
] | |
def get_token(): | |
auth = Auth(host, username=username, password=password, verify_certificate=False) | |
token_data = auth.token.new('wazo_user', expiration=3600) | |
return token_data['token'] | |
token = get_token() | |
c = Client(host, token, events) | |
def callback(data): | |
print data | |
c.on('call_created', callback) | |
c.on('call_ended', callback) | |
c.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment