Created
November 3, 2015 13:46
-
-
Save sboily/e8cae542d858a495992a to your computer and use it in GitHub Desktop.
make call with xivo
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/env python | |
from xivo_ctid_ng_client import Client | |
from xivo_auth_client import Client as Auth | |
import time | |
c = Client('192.168.1.124', verify_certificate=False) | |
a = Auth('192.168.1.124', username='sylvain', password='sylvain') | |
t = a.token.new('xivo_user', expiration=10) | |
token = t['token'] | |
uuid = t['xivo_user_uuid'] | |
params = { | |
"destination": { | |
"extension": "8001", | |
"context": "default", | |
"priority": 1 | |
}, | |
"source": { | |
"user": uuid | |
} | |
} | |
call = c.calls.make_call(params, token=token) | |
call_id = call['call_id'] | |
print "Call emit:", call_id | |
time.sleep(3) | |
print "call info..." | |
print c.calls.get_call(call_id, token=token) | |
time.sleep(2) | |
print "hangup call..." | |
c.calls.hangup(call_id, token=token) | |
a.token.revoke(token) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment