code: public void onEvent(final SipPacket msg) throws SipPacketParseException {
          if (msg == null) {
              return;
          }
  
          final SipPacket previousMsg = this.messages.isEmpty() ? null : this.messages.last();
          this.messages.add(msg);
  
          if (previousMsg != null && msg.getArrivalTime() < previousMsg.getArrivalTime()) {
              redrive();
              return;
          }
  
          try {
              handleStateChange(msg);
          } catch (final SipPacketParseException e) {
              e.printStackTrace();
          }
      }
docs: At some point we may want to have a generic event but for now this will
  only be {@link SipPacket}s.
  
  Note, if the {@link SipPacket} arrived earlier than the oldest element
  that this {@link SimpleCallStateMachine} has seen before then this new
  {@link SipPacket} will be inserted in the time sequence and then all the
  events will be "re-played".
  
  @param msg