java.lang.Object
com.bytedesk.call.esl.client.transport.event.EslEvent

public class EslEvent extends Object
FreeSWITCH Event Socket events are decoded into this data object.

An ESL event is modelled as a collection of text lines. An event always has several eventHeader lines, and optionally may have some eventBody lines. In addition the messageHeaders of the original containing EslMessage which carried the event are also available.

The eventHeader lines are parsed and cached in a map keyed by the eventHeader name string. An event is always expected to have an "Event-Name" eventHeader. Commonly used eventHeader names are coded in EslEventHeaderNames

Any eventBody lines are cached in a list.

The messageHeader lines from the original message are cached in a map keyed by EslHeaders.Name.

See Also:
  • Field Details

  • Constructor Details

    • EslEvent

      public EslEvent(EslMessage rawMessage)
    • EslEvent

      public EslEvent(EslMessage rawMessage, boolean parseCommandReply)
  • Method Details

    • getMessageHeaders

      public Map<EslHeaders.Name,String> getMessageHeaders()
      The message headers of the original ESL message from which this event was decoded. The message headers are stored in a map keyed by EslHeaders.Name. The string mapped value is the parsed content of the header line (ie, it does not include the header name).
      Returns:
      map of header values
    • getEventHeaders

      public Map<String,String> getEventHeaders()
      The event headers of this event. The headers are parsed and stored in a map keyed by the string name of the header, and the string mapped value is the parsed content of the event header line (ie, it does not include the header name).
      Returns:
      map of event header values
    • getEventBodyLines

      public List<String> getEventBodyLines()
      Any event body lines that were present in the event.
      Returns:
      list of decoded event body lines, may be an empty list.
    • getEventName

      public String getEventName()
      Convenience method.
      Returns:
      the string value of the event header "Event-Name"
    • getEventDateTimestamp

      public long getEventDateTimestamp()
      Convenience method.
      Returns:
      long value of the event header "Event-Date-Timestamp"
    • getEventDateLocal

      public String getEventDateLocal()
      Convenience method.
      Returns:
      long value of the event header "Event-Date-Local"
    • getEventDateGmt

      public String getEventDateGmt()
      Convenience method.
      Returns:
      long value of the event header "Event-Date-GMT"
    • hasEventBody

      public boolean hasEventBody()
      Convenience method.
      Returns:
      true if the eventBody list is not empty.
    • parsePlainBody

      private void parsePlainBody(List<String> rawBodyLines)
    • toString

      public String toString()
      Overrides:
      toString in class Object