Methods
Objects
Control calls in real-time!
To control phone calls in real-time, we need an URL from you.
We will send POST requests to your URL with the current status of the call, and you will reply with commands.
This way, you control calls in real-time!
Summary
Call objects are defined in the reference.
require 'vendor/autoload.php'; // Composer $api = new \CALLR\API\Client; $api->setAuth(new \CALLR\API\Authentication\LoginPasswordAuth('login', 'password'));
var callr = require('callr'); var api = new callr.api(callr.loginPasswordAuth('login', 'password'));
require 'callr' api = CALLR::Api.new('login', 'password')
import callr api = callr.Api("login", "password")
URLs are stored in what we call a "Voice App" (a JSON configuration object).
You can create as many URL as you like, just create one object per URL!
$options = (object) [ 'url' => 'http://yourdomain.com/realtime_callback_url' ]; $app = $api->call('apps.create', ['REALTIME10', 'Your app name', $options]); // save $app->hash, it will be used next!
var options = { url: 'http://yourdomain.com/realtime_callback_url' }; api.call('apps.create', 'REALTIME10', 'Your app name', options).success(function(app) { // app.hash will be used for realtime call });
options = { :url => 'http://yourdomain.com/realtime_callback_url' } app = api.call('apps.create', 'REALTIME10', 'Your app name', options) # save app.hash, it will be used next!
options = { 'url': 'http://yourdomain.com/realtime_callback_url' } app = api.call('apps.create', 'REALTIME10', 'Your app name', options) # save app.hash, it will be used next!
You can assign a phone number (DID) to the app.
For each call we receive on the phone number, we will make a POST request to your URL, so you can control the call.
Method
$api->call('apps.assign_did', [$app->hash, $did_hash]);
api.call('apps.assign_did', app.hash, did_hash);
result = api.call('apps.assign_did', app.hash, 'DID ID')
result = api.call('apps.assign_did', app.hash, 'DID ID')
Call any number in the world!
$target = (object) [ 'number' => '+447890123456', 'timeout' => 30 ]; $options = (object) [ 'cdr_field' => '42', 'cli' => 'BLOCKED' ]; $result = $api->call('calls.realtime', [$app->hash, $target, $options]);
var target = { number: '+16469820800', timeout: 30 }; var callOptions = { cdr_field: '42', cli: 'BLOCKED' }; api.call('calls.realtime', app.hash, target, callOptions).success(function(callid) { // success callback }).error(function(error) { // error callback });
target = { :number => '+33612345678', :timeout => 30 } callOptions = { :cdr_field => '42', :cli => 'BLOCKED' } result = api.call('calls.realtime', app.hash, target, callOptions)
target = { 'number': '+447890123456', 'timeout': 30 } callOptions = { 'cdr_field': '42', 'cli': 'BLOCKED' } result = api.call('calls.realtime', app.hash, target, callOptions)