Skip to content

Instantly share code, notes, and snippets.

@sboily
Created November 27, 2018 13:30
Show Gist options
  • Save sboily/6ce08f93afe011004bb23483ae39e60b to your computer and use it in GitHub Desktop.
Save sboily/6ce08f93afe011004bb23483ae39e60b to your computer and use it in GitHub Desktop.
#!/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