SDK in Python for CALLR API
Install via PyPI
pip install callr
Or get sources from Github
Pip
import callr
api = callr.Api("login", "password")
Source
import sys
sys.path.append("/path/to/callr_folder")
import callr
api = callr.Api("login", "password")
try:
# Set your credentials
api = callr.Api("login", "password")
# This will raise an exception
api.call("sms.send", "SMS")
# Exceptions handler
except (callr.CallrException, callr.CallrLocalException) as e:
print "ERROR: %s" % e.code
print "MESSAGE: %s" % e.msg
print "DATA: ", e.data
result = api.call('sms.send', 'SMS', '+33123456789', 'Hello world!', None)
Method
Your sender must have been authorized and respect the sms_sender format
result = api.call('sms.send', 'Your Brand', '+33123456789', 'Hello world!', None)
Method
result = api.call('sms.send', '', '+33123456789', 'Hello world!', None)
Method
optionSMS = { 'force_encoding': 'GSM' }
result = api.call('sms.send', '', '+33123456789', 'Hello world!', optionSMS)
Method
Objects
text = ('Some super mega ultra long text to test message longer than 160 characters ' +
'Some super mega ultra long text to test message longer than 160 characters ' +
'Some super mega ultra long text to test message longer than 160 characters')
result = api.call('sms.send', 'SMS', '+33123456789', text, None)
Method
optionSMS = { 'nature': 'ALERTING' }
result = api.call('sms.send', 'SMS', '+33123456789', 'Hello world!', optionSMS)
Method
Objects
optionSMS = { 'user_data': '42' }
result = api.call('sms.send', 'SMS', '+33123456789', 'Hello world!', optionSMS)
Method
Objects
optionSMS = {
'webhook': { 'endpoint': 'https://yourdomain.com/webhook_endpoint' }
}
result = api.call('sms.send', 'SMS', '+33123456789', 'Hello world!', optionSMS)
Method
Objects
result = api.call('sms.get', 'SMSHASH')
Method
Objects
options = {
'url': 'https://yourdomain.com/realtime_callback_url'
}
result = api.call('apps.create', 'REALTIME10', 'Your app name', options)
Method
Objects
target = {
'number': '+33132456789',
'timeout': 30
}
callOptions = {
'cdr_field': '42',
'cli': 'BLOCKED'
}
result = api.call('dialr/call.realtime', 'appHash', target, callOptions)
Method
Objects
result = api.call('apps.assign_did', 'appHash', 'DID ID')
Method
Objects
result = api.call('did/areacode.countries')
Method
Objects
result = api.call('did/areacode.get_list', 'US', None)
Method
Objects
result = api.call('did/areacode.types', 'US')
Method
Objects
result = api.call('did/store.buy_order', 'OrderToken')
Method
Objects
result = api.call('did/store.cancel_order', 'OrderToken')
Method
result = api.call('did/store.cancel_subscription', 'DID ID')
Method
result = api.call('did/store.get_quota_status')
Method
Objects
result = api.call('did/store.get_quote', 0, 'GOLD', 1)
Method
*Objects/
result = api.call('did/store.reserve', 0, 'GOLD', 1, 'RANDOM')
Method
Objects
result = api.call('did/store.view_order', 'OrderToken')
Method
Objects
params = { 'open': True }
access = []
result = api.call('conference/10.create_room', 'room name', params, access)
Method
Objects
result = api.call('conference/10.assign_did', 'Room ID', 'DID ID')
Method
params = { 'open': True }
access = [
{ 'pin': '1234', 'level': 'GUEST' },
{ 'pin': '4321', 'level': 'ADMIN', 'phone_number': '+33123456789' }
]
result = api.call('conference/10.create_room', 'room name', params, access)
Method
Objects
result = api.call('conference/10.call_room_access', 'Room Access ID', 'BLOCKED', True)
Method
result = api.call('media/library.get_list', None)
Method
result = api.call('media/library.create', 'name')
Method
media_id = 0
result = api.call('media/library.set_content', media_id, 'text', 'base64_audio_data')
Method
media_id = 0
result = api.call('media/tts.set_content', media_id, 'Hello world!', 'TTS-EN-GB_SERENA', None)
Method
from = 'YYYY-MM-DD HH:MM:SS'
to = 'YYYY-MM-DD HH:MM:SS'
result = api.call('cdr.get', 'OUT', from, to, None, None)
Method
Objects
target = {
'number': '+33123456789',
'timeout': 30
}
messages = [131, 132, 'TTS|TTS_EN-GB_SERENA|Hello world! how are you ? I hope you enjoy this call. good bye.']
options = {
'cdr_field': 'userData',
'cli': 'BLOCKED',
'loop': 2
}
result = api.call('sendr/simple.broadcast_1', target, messages, options)
target = {
'number': '+33123456789',
'timeout': 30
}
messages = [131, 132, 134]
result = api.call('sendr/simple.broadcast_1', target, messages, None)
Method
Objects