/**
   * Puts this peer into a {@link CallPeerState#DISCONNECTED}, indicating a reason to the user, if
   * there is one.
   *
   * @param sessionIQ the {@link SessionIQ} that's terminating our session.
   */
  public void processSessionTerminate(SessionIQ sessionIQ) {
    String reasonStr = "Call ended by remote side.";
    ReasonPacketExtension reasonExt = sessionIQ.getReason();

    if (reasonStr != null && reasonExt != null) {
      Reason reason = reasonExt.getReason();

      if (reason != null) reasonStr += " Reason: " + reason.toString() + ".";

      String text = reasonExt.getText();

      if (text != null) reasonStr += " " + text;
    }

    getMediaHandler().getTransportManager().close();
    setState(CallPeerState.DISCONNECTED, reasonStr);
  }