Skip to main content

Answer

The Answer event is sent to the answerUrl specified in the createCall request when an outbound call is answered.

Request Parameters

PropertyDescription
eventTypeThe event type, value is answer
eventTimeThe approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
accountIdThe user account associated with the call.
applicationIdThe id of the application associated with the call.
toThe phone number that received the call, in E.164 format (e.g. +15555555555).
fromThe provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous.
directionThe direction of the call. Either inbound or outbound. The direction of a call never changes.
callIdThe call id associated with the event.
callUrlThe URL of the call associated with the event.
enqueuedTime(optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
startTimeTime the call was started, in ISO 8601 format.
answerTimeTime the call was answered, in ISO 8601 format.
tag(optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
machineDetectionResult(optional) if machine detection was requested in sync mode, the result will be specified here. Possible values are the same as the async counterpart: Machine Detection Complete

Expected Response

HTTP/1.1 200
Content-Type: application/xml; charset=utf-8

<Response>
<!-- BXML verbs to process in the call -->
</Response>

Examples

Answer Event

POST http://yourUrl.example/answer
Content-Type: application/json

{
"eventType" : "answer",
"eventTime" : "2019-06-20T15:54:25.435Z",
"accountId" : "55555555",
"applicationId" : "7fc9698a-b04a-468b-9e8f-91238c0d0086",
"from" : "+15551112222",
"to" : "+15553334444",
"direction" : "outbound",
"callId" : "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
"callUrl" : "https://voice.bandwidth.com/api/v2/accounts/55555555/calls/c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
"startTime" : "2019-06-20T15:54:22.234Z",
"answerTime" : "2019-06-20T15:54:25.432Z"
}

Answer Event with Tag

POST http://yourUrl.example/answer
Content-Type: application/json

{
"eventType" : "answer",
"eventTime" : "2019-06-20T15:54:25.435Z",
"accountId" : "55555555",
"applicationId" : "7fc9698a-b04a-468b-9e8f-91238c0d0086",
"from" : "+15551112222",
"to" : "+15553334444",
"direction" : "outbound",
"callId" : "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
"callUrl" : "https://voice.bandwidth.com/api/v2/accounts/55555555/calls/c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
"startTime" : "2019-06-20T15:54:22.234Z",
"answerTime" : "2019-06-20T15:54:25.432Z",
"tag" : "example-tag"
}

Answer Event with Machine Detection result

POST http://yourUrl.example/answer
Content-Type: application/json
{
"eventType" : "answer",
"eventTime" : "2021-11-10T11:20:02.950Z",
"accountId" : "55555555",
"applicationId" : "7fc9698a-b04a-468b-9e8f-91238c0d0086",
"from" : "+15551112222",
"to" : "+15553334444",
"direction" : "outbound",
"callId" : "c-aa90dc63-4a750bed-ddbf-47ac-8375-a90af5ca3ad1",
"callUrl" : "https://voice.bandwidth.com/api/v2/accounts/55555555/calls/c-aa90dc63-4a750bed-ddbf-47ac-8375-a90af5ca3ad1",
"startTime" : "2021-11-10T11:19:57.170Z",
"answerTime" : "2021-11-10T11:19:57.382Z",
"tag" : "example-tag",
"machineDetectionResult" : {
"value" : "answering-machine",
"duration" : "PT5.045329368S"
}
}

Answer Event for a Queued Call

POST http://yourUrl.example/answer
Content-Type: application/json

{
"eventType" : "answer",
"eventTime" : "2019-06-20T15:54:25.435Z",
"accountId" : "55555555",
"applicationId" : "7fc9698a-b04a-468b-9e8f-91238c0d0086",
"from" : "+15551112222",
"to" : "+15553334444",
"direction" : "outbound",
"callId" : "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
"callUrl" : "https://voice.bandwidth.com/api/v2/accounts/55555555/calls/c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
"enqueuedTime" : "2019-06-20T15:53:10.212Z",
"startTime" : "2019-06-20T15:54:22.234Z",
"answerTime" : "2019-06-20T15:54:25.432Z"
}