Docs

Make voice call

https://api.apifonica.com/v2/accounts/{accountSID}/calls

Overview

To initiate a call to a phone number or a SIP endpoint, make the POST request to /accounts/{accountSID}/calls.

When a call is initiated, a new instance of the calls resource is created (/accounts/{accountSID}/calls/{callSID}). You can then see the call status, cost and other details by requesting the corresponding resource instance.

For call status control please refer to the article Call progress events

XML commands: makeCall, endCall

ParameterRequiredDescriptionDefault Value
from
yes

Phone number to be used as a CallerID. This number must be rented from Apifonica.

Phone numbers should be formatted with a country code, but without a plus sign.

For example, 5315313424.

N/A
to
yes

Recipient’s number or virtual number. Phone numbers should be formatted with a country code, no plus sign.

For example, 883140777092718.

N/A
call_app_sid
no

Link to the existing application, which will be used for Call operations.

Important! Please note that the initial connection will be established with the number 'to' and then with the number, received from the 'call_app_sid' XML.

N/A
сli
no

Link to the existing application, which will be used for Call operations.

N/A
timeout
no

The number of seconds to wait for the answer of the 'to' number. If the timeout period has expired and nobody has answered, Apifonica API terminates the call.

Important! The period starts when you send the request to API.

60
events
no

The call progress events that Apifonica will send webhooks on. Can be 'all' or 'none'.

Events that are sent always: queued and modified.

none
tag
no

Optional string field; can be used for custom filtering of the calls

N/A
channel
no

The call channel. The possible values are 'number' (for calling on local/mobile/SIP numbers), 'viber' (for calling on Viber).

number

Request example

The following example demonstrates making a call to a landline phone number.

curl –X POST https://api.apifonica.com/v2/accounts/{accountSID}/messages \
-H 'Content-Type: application/json' \
-d '{
    "from": "35315313424",
    "to": "447860041755",
    "text": "Apifonica API provides a really cool SMS messaging service"
}' \
-u {accountSID}:{authToken}

The following example demonstrates making a call to Viber.

curl –X POST https://api.apifonica.com/v2/accounts/{accountSID}/calls \
-H 'Content-Type: application/json' \
-d '{
      "from": "35315313424",
      "to": "447860041755",
      "call_app_sid": "app1f255680-95dd-34c6-b83f-c86b8095adcb",
      "channel": "viber"
    }' \
-u {accountSID}:{authToken}

Response example

{
  "status_code": 201,
  "status_message": "CREATED",
  "uri": "/accounts/{accountSID}/calls/{callSID}"
}