Handle voice calls from client

Configuration

Set the parameter voice_start on your client phoenunumber to https://yourapp.io/elks/calls (or wherever your webhook code is). We'll make an HTTP POST request to this URL every time the client makes a call.

Request

POST https://yourapp.io/elks/calls
Example payload
direction=incoming&
id=sf8425555e5d8db61dda7a7b3f1b91bdb&
from=%2B4600100100&to=%2B46766861004&
created=2018-08-13T13%3A57%3A23.741000

Request parameters

Parameter Description
callid The unique id of the call in the 46elks call API.
from The client number that initaed the call.
to The phone number that the client is calling.
created The time in UTC when the call object was created in our systems.

Sample code

$call = Array(
  "connect"=>$_POST["to"],
  "callerid"=> "+46766761004",
  "busy" => Array("play"=>"https://your_server/busy.mp3"),
  "failed" => Array("play"=>"https://your_server/failed.mp3")
);

print json_encode($call);

Response structure

You must respond with a valid JSON struct to allow the call to continue. For example:

{
  "connect":"+4634090510",
  "callerid":"+46766861004",
  "failed":{"play":"https://yourapp.io/callfailed.wav"}
  "busy":{"play":"https://yourapp.io/callbusy.wav"}
}

Your webhook code must respond with a HTTP status in the range 200-204. If not, the API will end the call.