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

Parameter

Required?

Description

Default 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, 35315313424.

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

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

Required

yes

Description

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, 35315313424.

Default value

N/A

Required

yes

Description

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

For example,883140777092718.

Default value

N/A

Required

no

Description

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.

Default value

N/A

Required

no

Description

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.

Default value

60

Required

no

Description

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

Events that are sent always: queued and modified.

Default value

none

Required

no

Description

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

Default value

N/A

Request examples

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

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" \
    }’ \
-u {accountSID}:{authToken}

Response example

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