Class EventWebhook

java.lang.Object
com.vonage.client.JsonableBaseObject
com.vonage.client.voice.EventWebhook
All Implemented Interfaces:
Jsonable

public class EventWebhook extends JsonableBaseObject
Represents all call events sent to the event_url webhook configured in your Voice application settings. See the webhook reference for details. For the answer_url webhook, use AnswerWebhook. The fields present depends on which event has occurred. This class maps all known fields for all events.
Since:
8.2.0
  • Constructor Details

  • Method Details

    • getStatus

      Event type.
      Returns:
      The call status as an enum.
    • getDirection

      Call direction, can be either inbound or outbound.
      Returns:
      The call direction as an enum, or null if not applicable.
    • getDetail

      Provides a more specific status to accompany getStatus().
      Returns:
      The event status detail as an enum, or null if not applicable.
    • getMachineDetectionSubstate

      Advanced machine detection status, when call is answered by voicemail and the beep is detected. This is present if getStatus() is CallStatus.HUMAN or CallStatus.MACHINE.
      Returns:
      The machine detection substate, or null if not applicable.
    • getDtmf

      public DtmfResult getDtmf()
      DTMF capturing results. This is only present if getStatus() is CallStatus.INPUT.
      Returns:
      The DTMF input, or null if not applicable.
    • getSpeech

      Speech recognition results. This is only present if getStatus() is CallStatus.INPUT.
      Returns:
      The speech properties, or null if not applicable.
    • getTimestamp

      Event timestamp in ISO 8601 format.
      Returns:
      The timestamp as an Instant, or null if unknown.
    • getStartTime

      Start time in ISO 8601 format. This is applicable to recording events.
      Returns:
      The start time as an Instant, or null if unknown / not applicable.
    • getEndTime

      public Instant getEndTime()
      End time in ISO 8601 format. This is applicable to recording events.
      Returns:
      The end time as an Instant, or null if unknown / not applicable.
    • getDuration

      public Integer getDuration()
      Call length, in seconds. This is present if getStatus() is CallStatus.COMPLETED.
      Returns:
      The length of the call, or null if not applicable.
    • getSize

      public Integer getSize()
      Size of the recording file, in bytes. This is present for recording events only.
      Returns:
      The file size in bytes, or null if not applicable.
    • getRate

      public Double getRate()
      Cost per minute of the call, in Euros. This will be present if getStatus() is CallStatus.COMPLETED.
      Returns:
      The call rate as a double, or null if not applicable.
    • getPrice

      public Double getPrice()
      Total cost of the call in Euros. This will be present if getStatus() is CallStatus.COMPLETED.
      Returns:
      The call cost as a double, or null if not applicable.
    • getRecordingUrl

      public URI getRecordingUrl()
      Where to download the recording. This is present for recording and transcription events only.
      Returns:
      The URL of the recording, or null if not applicable.
    • getCallUuid

      public String getCallUuid()
      Unique identifier for the call event.
      Returns:
      The call ID as a string, or null not applicable.
    • getRecordingUuid

      Unique identifier for the recording. This is only present for recording events.
      Returns:
      The recording ID as a string, or null if not applicable.
    • getTo

      public String getTo()
      Number the call was made to, in E.164 format.
      Returns:
      The call destination, or null if not applicable.
    • getFrom

      public String getFrom()
      Number the call came from, in E.164 format.
      Returns:
      The call source number, or null if not applicable.
    • getConversationUuid

      Unique identifier for the conversation. Starts with CON- followed by a UUID.
      Returns:
      The conversation ID as a string, or null if not applicable.
    • getConversationUuidFrom

      Conversation ID that the leg was originally in. This is only present if getStatus() is CallStatus.TRANSFER.
      Returns:
      The originating conversation ID leg, or null if not applicable.
    • getConversationUuidTo

      Conversation ID that the leg was transferred to. This is only present if getStatus() is CallStatus.TRANSFER.
      Returns:
      The destination conversation ID leg, or null if not applicable.
    • getNetwork

      public String getNetwork()
      Type of network that was used in the call.
      Returns:
      The network, or null if unknown / not applicable.
    • getReason

      public String getReason()
      Information about the nature of the error. This is only present for error webhooks.
      Returns:
      The error description, or null if not applicable.
    • fromJson

      public static EventWebhook fromJson(String json)
      Constructs an instance, populating this class's fields from the JSON string.
      Parameters:
      json - The JSON payload as a string.
      Returns:
      A new instance of this class.