Skip to content

REST Resource: projects.calls

Resource: Call

The Call resource. This represents a call, such as an SMS.

JSON representation
{
  "name": string,
  "to": string,
  "from": string,
  "fromLocation": {
    object (NumberLocation)
  },
  "fromZone": string,
  "isPrivate": boolean,
  "labels": {
    string: string,
    ...
  },
  "transport": enum (Transport),
  "direction": enum (Direction),
  "errorCode": string,
  "errorMessage": string,
  "price": {
    object (google.type.Money)
  },
  "state": enum (State),
  "createTime": string (Timestamp),
  "startTime": string (Timestamp),
  "ringTime": string (Timestamp),
  "answerTime": string (Timestamp),
  "endTime": string (Timestamp),
  "bridged": boolean,
  "originatingCall": string,
  "createMethod": enum (CreateMethod),
  "options": {
    object (ApiCallOptions)
  },
  "sipCallId": string,
  "answerDuration": string (Duration)
}
Fields  
name string
Resource name of the call. It is of the form projects/*/calls/*
to string
Required. The recipient of the call.

For PSTN calls, this is the phone number in +E164 format.

For calls to a SIP domain, this is the URI in the To header, in the format sip:user-or-number@domain.

When placing outgoing API calls, only PSTN is supported.
from string
Required. The originator of the call.

For PSTN calls, this is the CLI (Caller ID) in +E164 format. When placing outgoing API calls, this is required.

For calls to a SIP domain, this is the URI in the From header, in the format sip:user-or-number@domain.

This field will not be set if the CLI originated from the PSTN and is_private is true.
fromLocation object (NumberLocation)
The approximate location where the call originated from. Only set for INCOMING calls (this may be changed in the future).
fromZone string
The zone associated with the from phone number, if applicable. Only applicable for PSTN. Only set for INCOMING calls (this may be changed in the future).
isPrivate boolean
Whether the Caller ID is private.
labels map (key: string, value: string)
You can store any arbitrary data against labels. The maximum number of keys is 50. The maximum length of all keys and values combined is 10kB.
transport enum (Transport)
Output only. The transport that carried this call.
direction enum (Direction)
Output only. The direction of the call. Can be outgoing for calls that are sent or incoming for calls that are received.
errorCode string
Output only. If the outgoing call failed to be delivered, the reason why.
errorMessage string
Output only. The human readable call associated with the error.
price object (google.type.Money format)
Output only. The price of this call. This may be set at various times. Generally, it is available when the call reaches a terminal state, either immediately or shortly afterwards.

This price is the price of the call itself, and does not include charges from the consumption of other paid services, such as text-to-speech and transcription.
state enum (State)
Output only. The current state of the call.
createTime string (Timestamp format)
Output only. The creation time of the call. Output only.
startTime string (Timestamp format)
Output only. The time the call was started. For an incoming call, this is the same as create_time. For an outgoing call, this is the time that the call attempt commenced.
ringTime string (Timestamp format)
Output only. The time the call started ringing. Only set for outgoing call.
answerTime string (Timestamp format)
Output only. The time the call was answered.
endTime string (Timestamp format)
Output only. The time the call finished.
bridged boolean
Output only. Was the call bridged with another call at any point?
originatingCall string
Output only. The name of the call that originated this call, set for outgoing calls that were created during the execution of another call, of the form projects/*/calls/*.
createMethod enum (CreateMethod)
Output only. How this call started.
options object (ApiCallOptions)
Required. The options to use to handle this call. This is only required when a call is created using the API.
sipCallId string
Output only. The Call-ID header of the call. Only set when transport is SIP.
answerDuration string (Duration format)
Output only. The duration for which the call was answered. If the call was not answered or it has not reached a terminal state, this field will not be set.

NumberLocation

Location information for a phone number.

JSON representation
{
  "regionCode": string,
  "administrativeArea": string,
  "locality": string,
  "coordinates": {
    object (google.type.LatLng)
  }
}
Fields  
regionCode string
CLDR region code of the country/region. See http://cldr.unicode.org/ and http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "AU" for Australia.
administrativeArea string
If known, the highest administrative subdivision of a country or region. For example, this can be a state, a territory, a province, an oblast, or a prefecture.
locality string
If known, the locality associated with the phone number. Generally refers to the city/town portion of the address. Examples: AU suburb, US city, IT comune, UK post town.
coordinates object (google.type.LatLng format)
If known, the approximate coordinates of the location.

Call.Transport

The transport of a call.

Enums  
TRANSPORT_UNSPECIFIED Unspecified transport.
PSTN The call was transported over PSTN (Public Switched Telephone Network).
CLIENT The call was transported over an Enfonica Client (WebRTC).
SIP The call was transported over SIP.

Call.Direction

The direction of a call.

Enums  
DIRECTION_UNSPECIFIED Unspecified direction.
OUTGOING An outgoing call.
INCOMING An incoming call

Call.State

The state of a call.

Enums  
STATE_UNSPECIFIED Unspecified status.
QUEUED The call has been queued.
STARTING The call is being attempted.
RINGING The remote party is ringing.
IN_PROGRESS The call has been answered.
COMPLETED The call was answered and is now finished.
FAILED The call could not be made.
NOT_ANSWERED The call was not answered. This is the same as the call waiting to be answered and timing out.
BUSY The remote party indicated they were busy.
REJECTED The call was not answered and it was actively rejected.

Call.CreateMethod

How a call was created.

Enums  
CREATE_METHOD_UNSPECIFIED Unspecified create method.
INCOMING_CALL The call was created as a result of receiving an incoming call.
PARENT_CALL The call was created by its parent call, e.g. VoiceML <Call> or <Redirect>.
API The call was creating using the API.

Call.ApiCallOptions

Options that are applied to the call when it is an outgoing call created by the API.

JSON representation
{
  "handlerUris": [
    string
  ],
  "stateUpdateUri": string,
  "timeoutSeconds": number (int32),
  "recording": {
    object (CallRecordingConfig)
  }
}
Fields  
handlerUris[] string
Required. One or more URIs where VoiceML requests should be made to control the call. The first URI will be attempted first, while the other URIs are only used if the initial URI fails. Can be any supported URI. Minimum 1 URI, maximum 5 URIs.
stateUpdateUri string
The URL where state updates should be sent.
timeoutSeconds number (int32 format)
The maximum amount of time, in seconds, the call is allowed to attempt an endpoint. Default 30 seconds. Minimum 1, maximum 600 seconds.
recording object (CallRecordingConfig)
The configuration of call recording. If not specified, no call recording will be configured.

Methods

Methods  
create POST /v1beta1/{parent}/calls
Creates a call in the state QUEUED. This will cause an outgoing call to be started.

The caller must have voice.calls.create permission on the project.
get GET /v1beta1/{name}
Retrieves a Call identified by the supplied resource name.

The caller must have voice.calls.get permission on the project.
list GET /v1beta1/{parent}/calls
Lists the Calls of the specified project. List returns Calls sorted by create_time descending.

The caller must have voice.calls.list permission on the project.