Gather
The gather event is sent after a <Gather>
verb is executed. Its purpose is to report the gathered digits to the calling application.
Request Parameters
Property | Description |
---|---|
eventType | The event type, value is gather . |
eventTime | The 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. |
accountId | The user account associated with the call. |
applicationId | The id of the application associated with the call. |
to | The phone number that received the call, in E.164 format (e.g. +15555555555). |
from | The provided identifier string of the caller used in the from field of the original call. |
direction | The direction of the call. Either inbound or outbound . The direction of a call never changes. |
callId | The call id associated with the event. |
parentCallId | (optional) If the event is related to the B leg of a <Transfer> , the call id of the original call leg that executed the <Transfer> . Otherwise, this field will not be present. |
callUrl | The 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. |
startTime | Time the call was started, in ISO 8601 format. |
answerTime | Time the call was answered, in ISO 8601 format. |
tag | (optional) The tag specified earlier in the call. If no tag was specified or it was previously cleared, this field will not be present. |
digits | (optional) The digits, letters, and/or symbols entered by the user. The string is empty if a timeout occurred before any buttons were pressed. |
terminatingDigit | (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. |
transferCallerId | (optional) If the event is related to the B leg of a <Transfer> , the phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). Otherwise, this field will not be present. |
transferTo | (optional) If the event is related to the B leg of a <Transfer> , the phone number used as the to field of the B-leg call in E.164 format (e.g. +15555555555). Otherwise, this field will not be present. |
Expected Response
HTTP/1.1 200
Content-Type: application/xml; charset=utf-8
<Response>
<!-- BXML verbs to process in the call -->
</Response>
Examples
Gather Completed Because Max Digits were Pressed
POST http://yourUrl.example/gather
Content-Type: application/json
{
"eventType" : "gather",
"eventTime" : "2019-06-20T15:56:11.554Z",
"accountId" : "55555555",
"applicationId" : "7fc9698a-b04a-468b-9e8f-91238c0d0086",
"startTime" : "2019-06-20T15:54:22.234Z",
"answerTime" : "2019-06-20T15:54:25.432Z",
"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",
"digits" : "25",
"terminatingDigit" : ""
}
Gather Completed Because Terminating Digit was Pressed
POST http://yourUrl.example/gather
Content-Type: application/json
{
"eventType" : "gather",
"eventTime" : "2019-06-20T15:56:11.554Z",
"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",
"digits" : "123",
"terminatingDigit" : "#"
}
Gather Completed Because Terminating Digit was Pressed with Enqueued Time
POST http://yourUrl.example/gather
Content-Type: application/json
{
"eventType" : "gather",
"eventTime" : "2019-06-20T15:56:11.554Z",
"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:22.681Z",
"startTime" : "2019-06-20T15:54:22.234Z",
"answerTime" : "2019-06-20T15:54:25.432Z",
"digits" : "123",
"terminatingDigit" : "#"
}