# Service enfonica.voice.v1beta1.Calls

## Methods

| CreateCall |
| -- |
| <span class="e-code">rpc CreateCall(<span class="e-code">[CreateCallRequest](#createcallrequest)</span>) returns (<span class="e-code">[Call](#resource-call)</span>)</span><br/><br/>Creates a call in the state QUEUED. This will cause an outgoing call to be started.<br/><br/>The caller must have `voice.calls.create` permission on the project. |

| GetCall |
| -- |
| <span class="e-code">rpc GetCall(<span class="e-code">[GetCallRequest](#getcallrequest)</span>) returns (<span class="e-code">[Call](#resource-call)</span>)</span><br/><br/>Retrieves a Call identified by the supplied resource name.<br/><br/>The caller must have `voice.calls.get` permission on the project. |

| ListCalls |
| -- |
| <span class="e-code">rpc ListCalls(<span class="e-code">[ListCallsRequest](#listcallsrequest)</span>) returns (<span class="e-code">[ListCallsResponse](#listcallsresponse)</span>)</span><br/><br/>Lists the Calls of the specified project. List returns Calls sorted by create_time descending.<br/><br/>The caller must have `voice.calls.list` permission on the project. |

## Resource: Call

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

Fields | &nbsp;
--|--
<span class="e-code">name</span> | <span class="e-code">string</span><br/>Resource name of the call. It is of the form `projects/*/calls/*`
<span class="e-code">to</span> | <span class="e-code">string</span><br/>Required. The recipient of the call.<br/><br/>For PSTN calls, this is the phone number in +E164 format.<br/><br/>For calls to a SIP domain, this is the URI in the To header, in the format `sip:user-or-number@domain`.<br/><br/>When placing outgoing API calls, only PSTN is supported. 
<span class="e-code">from</span> | <span class="e-code">string</span><br/>Required. The originator of the call.<br/><br/>For PSTN calls, this is the CLI (Caller ID) in +E164 format. When placing outgoing API calls, this is required.<br/><br/>For calls to a SIP domain, this is the URI in the From header, in the format `sip:user-or-number@domain`.<br/><br/>This field will not be set if the CLI originated from the PSTN and `is_private` is true. 
<span class="e-code">from_location</span> | <span class="e-code">[NumberLocation](#numberlocation)</span><br/>The approximate location where the call originated from. Only set for INCOMING calls (this may be changed in the future). 
<span class="e-code">from_zone</span> | <span class="e-code">string</span><br/>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). 
<span class="e-code">is_private</span> | <span class="e-code">boolean</span><br/>Whether the Caller ID is private.
<span class="e-code">labels</span> | <span class="e-code">map<<span class="e-code">string</span>, <span class="e-code">string</span>></span><br/>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.
<span class="e-code">transport</span> | <span class="e-code">[Transport](#calltransport)</span><br/>Output only. The transport that carried this call.
<span class="e-code">direction</span> | <span class="e-code">[Direction](#calldirection)</span><br/>Output only. The direction of the call. Can be `outgoing` for calls that are sent or `incoming` for calls that are received.
<span class="e-code">error_code</span> | <span class="e-code">string</span><br/>Output only. If the outgoing call failed to be delivered, the reason why.
<span class="e-code">error_message</span> | <span class="e-code">string</span><br/>Output only. The human readable call associated with the error.
<span class="e-code">price</span> | <span class="e-code"><a href="https://github.com/googleapis/googleapis/blob/master/google/type/money.proto" target="_blank">google.type.Money</a></span><br/>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.<br/><br/>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.
<span class="e-code">state</span> | <span class="e-code">[State](#callstate)</span><br/>Output only. The current state of the call.
<span class="e-code">create_time</span> | <span class="e-code"><a href="https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp" target="_blank">google.protobuf.Timestamp</a></span><br/>Output only. The creation time of the call. Output only.
<span class="e-code">start_time</span> | <span class="e-code"><a href="https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp" target="_blank">google.protobuf.Timestamp</a></span><br/>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.
<span class="e-code">ring_time</span> | <span class="e-code"><a href="https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp" target="_blank">google.protobuf.Timestamp</a></span><br/>Output only. The time the call started ringing. Only set for outgoing call.
<span class="e-code">answer_time</span> | <span class="e-code"><a href="https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp" target="_blank">google.protobuf.Timestamp</a></span><br/>Output only. The time the call was answered.
<span class="e-code">end_time</span> | <span class="e-code"><a href="https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp" target="_blank">google.protobuf.Timestamp</a></span><br/>Output only. The time the call finished.
<span class="e-code">bridged</span> | <span class="e-code">boolean</span><br/>Output only. Was the call bridged with another call at any point?
<span class="e-code">originating_call</span> | <span class="e-code">string</span><br/>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/*`.
<span class="e-code">create_method</span> | <span class="e-code">[CreateMethod](#callcreatemethod)</span><br/>Output only. How this call started.
<span class="e-code">options</span> | <span class="e-code">[ApiCallOptions](#callapicalloptions)</span><br/>Required. The options to use to handle this call. This is only required when a call is created using the API.
<span class="e-code">sip_call_id</span> | <span class="e-code">string</span><br/>Output only. The `Call-ID` header of the call. Only set when transport is SIP.
<span class="e-code">answer_duration</span> | <span class="e-code"><a href="https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration" target="_blank">google.protobuf.Duration</a></span><br/>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.

## Call.ApiCallOptions

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

Fields | &nbsp;
--|--
<span class="e-code">handler_uris[]</span> | <span class="e-code">string</span><br/>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.
<span class="e-code">state_update_uri</span> | <span class="e-code">string</span><br/>The URL where state updates should be sent.
<span class="e-code">timeout_seconds</span> | <span class="e-code">int32</span><br/>The maximum amount of time, in seconds, the call is allowed to attempt an endpoint. Default 30 seconds. Minimum 1, maximum 600 seconds. 
<span class="e-code">recording</span> | <span class="e-code">[CallRecordingConfig](/docs/cloud-voice/api-reference/rpc/enfonica.voice.v1beta1/CallRecordingConfig/)</span><br/>The configuration of call recording. If not specified, no call recording will be configured.

## Call.CreateMethod

How a call was created.

Enums | &nbsp;
--|--
<span class="e-code">CREATE_METHOD_UNSPECIFIED</span> | Unspecified create method.
<span class="e-code">INCOMING_CALL</span> | The call was created as a result of receiving an incoming call.
<span class="e-code">PARENT_CALL</span> | The call was created by its parent call, e.g. VoiceML `<Call>` or `<Redirect>`.
<span class="e-code">API</span> | The call was creating using the API.

## Call.Direction

The direction of a call.

Enums | &nbsp;
--|--
<span class="e-code">DIRECTION_UNSPECIFIED</span> | Unspecified direction.
<span class="e-code">OUTGOING</span> | An outgoing call.
<span class="e-code">INCOMING</span> | An incoming call

## Call.State

The state of a call.

Enums | &nbsp;
--|--
<span class="e-code">STATE_UNSPECIFIED</span> | Unspecified status.
<span class="e-code">QUEUED</span> | The call has been queued.
<span class="e-code">STARTING</span> | The call is being attempted.
<span class="e-code">RINGING</span> | The remote party is ringing.
<span class="e-code">IN_PROGRESS</span> | The call has been answered.
<span class="e-code">COMPLETED</span> | The call was answered and is now finished.
<span class="e-code">FAILED</span> | The call could not be made.
<span class="e-code">NOT_ANSWERED</span> | The call was not answered. This is the same as the call waiting to be answered and timing out.
<span class="e-code">BUSY</span> | The remote party indicated they were busy.
<span class="e-code">REJECTED</span> | The call was not answered and it was actively rejected.

## Call.Transport

The transport of a call.

Enums | &nbsp;
--|--
<span class="e-code">TRANSPORT_UNSPECIFIED</span> | Unspecified transport.
<span class="e-code">PSTN</span> | The call was transported over PSTN (Public Switched Telephone Network).
<span class="e-code">CLIENT</span> | The call was transported over an Enfonica Client (WebRTC).
<span class="e-code">SIP</span> | The call was transported over SIP.

## NumberLocation

Location information for a phone number.

Fields | &nbsp;
--|--
<span class="e-code">region_code</span> | <span class="e-code">string</span><br/>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.
<span class="e-code">administrative_area</span> | <span class="e-code">string</span><br/>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.
<span class="e-code">locality</span> | <span class="e-code">string</span><br/>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.
<span class="e-code">coordinates</span> | <span class="e-code"><a href="https://github.com/googleapis/googleapis/blob/master/google/type/latlng.proto" target="_blank">google.type.LatLng</a></span><br/>If known, the approximate coordinates of the location.

## CallRecordingConfig

The configuration of how a call is recorded and transcribed.

You need to comply with certain laws and regulations, including those regarding obtaining consent to record. Enfonica recommends that you consult with your legal counsel to make sure that you are complying with all applicable laws in connection with communications you record or store using Enfonica.

Fields | &nbsp;
--|--
<span class="e-code">trigger</span> | <span class="e-code">[CallRecordingTrigger](/docs/cloud-voice/api-reference/rpc/enfonica.voice.v1beta1/CallRecordingConfig.CallRecordingTrigger/)</span><br/>Whether to record the call, and the event that should trigger recording to start. Defaults to DISABLED.
<span class="e-code">post_processing[]</span> | <span class="e-code">[PostProcessing](/docs/cloud-voice/api-reference/rpc/enfonica.voice.v1beta1/PostProcessing/)</span><br/>What post processing to perform on the recording. Defaults to NONE.
<span class="e-code">recording_ready_uri</span> | <span class="e-code">string</span><br/>The absolute URI where the recording ready webhook should be sent.
<span class="e-code">transcribe</span> | <span class="e-code">[TranscribeOption](/docs/cloud-voice/api-reference/rpc/enfonica.voice.v1beta1/TranscribeOption/)</span><br/>Whether to transcribe the call. If transcription is enabled, call recording must also be enabled. Defaults to DISABLED.
<span class="e-code">transcription_ready_uri</span> | <span class="e-code">string</span><br/>The absolute URI where the transcription ready webhook should be sent.

## CallRecordingConfig.CallRecordingTrigger

The trigger to start call recording.

Enums | &nbsp;
--|--
<span class="e-code">CALL_RECORDING_TRIGGER_UNSPECIFIED</span> | Unspecified recording trigger.
<span class="e-code">DISABLED</span> | Recording is disabled.
<span class="e-code">ANSWER</span> | Recording will begin when the call is answered.
<span class="e-code">BRIDGE</span> | Recording will begin when the call is bridged. This won't include any messages or menus played before the call was bridged. This is useful if you want to record only conversations.

## PostProcessing

Post processing options.

Enums | &nbsp;
--|--
<span class="e-code">POST_PROCESSING_UNSPECIFIED</span> | Unspecified post processing.
<span class="e-code">TRIM_SILENCE</span> | Trim silence from the start and end of the audio.

## TranscribeOption

How transcription should operate.

Enums | &nbsp;
--|--
<span class="e-code">TRANSCRIBE_OPTION_UNSPECIFIED</span> | Unspecified transcribe option.
<span class="e-code">DISABLED</span> | Transcription is disabled.
<span class="e-code">DEFAULT</span> | Transcribe using Enfonica's default transcription provider.

## CreateCallRequest

Request to create a new call.

Fields | &nbsp;
--|--
<span class="e-code">parent</span> | <span class="e-code">string</span><br/>Required. The project under which to create the call in the form `projects/*`.
<span class="e-code">call</span> | <span class="e-code">[Call](#resource-call)</span><br/>Required. The call resource to be created.

## GetCallRequest

The GetCall request call.

Fields | &nbsp;
--|--
<span class="e-code">name</span> | <span class="e-code">string</span><br/>Required. The resource name of the Call to retrieve. Must be of the form `projects/*/calls/*`.

## ListCallsRequest

The ListCalls request call.

Fields | &nbsp;
--|--
<span class="e-code">parent</span> | <span class="e-code">string</span><br/>Required. The resource name of the parent of which to list calls. Must be of the form `projects/*`.
<span class="e-code">page_size</span> | <span class="e-code">int32</span><br/>The maximum number of Calls to return in the response. Default value of 10 and maximum value of 100.
<span class="e-code">page_token</span> | <span class="e-code">string</span><br/>A pagination token returned from a previous call to `ListCalls` that indicates where this listing should continue from.
<span class="e-code">filter</span> | <span class="e-code">string</span><br/>Filter string to specify which results should be returned.<br/><br/>The following fields can be filtered: - `createTime` - `to` - `from` - `state` - `direction` - `transport`<br/><br/>For example: createTime >= '2021-01-01T06:00:00.0Z' AND createTime < '2021-02-01' AND state = COMPLETED OR state = BUSY AND to = '+61*' OR from = '+61*'<br/><br/>Note that OR has higher precendence than AND.

## ListCallsResponse

The ListCalls response call.

Fields | &nbsp;
--|--
<span class="e-code">calls[]</span> | <span class="e-code">[Call](#resource-call)</span><br/>A possibly paginated list of Calls that are direct descendants of the specified parent resource.
<span class="e-code">next_page_token</span> | <span class="e-code">string</span><br/>A pagination token returned from a previous call to `ListCalls` that indicates from where listing should continue.

