示例#1
0
 /**
  * Gets and formats the names of the peers in the call.
  *
  * @param maxLength maximum length of the filename
  * @return the name of the peer in the call formated
  */
 private String getCallPeerName(int maxLength) {
   List<CallPeer> callPeers = call.getConference().getCallPeers();
   CallPeer callPeer = null;
   String peerName = "";
   if (!callPeers.isEmpty()) {
     callPeer = callPeers.get(0);
     if (callPeer != null) {
       peerName = callPeer.getDisplayName();
       peerName = peerName.replaceAll("[^\\da-zA-Z\\_\\-@\\.]", "");
       if (peerName.length() > maxLength) {
         peerName = peerName.substring(0, maxLength);
       }
     }
   }
   return peerName;
 }
  /**
   * Indicates that the security is time-outed, is not supported by the other end.
   *
   * @param evt Details about the event that caused this message.
   */
  @Override
  public void securityTimeout(CallPeerSecurityTimeoutEvent evt) {
    timer.cancel();

    // fail peer, call
    if (evt.getSource() instanceof AbstractCallPeer) {
      try {
        CallPeer peer = (CallPeer) evt.getSource();
        OperationSetBasicTelephony<?> telephony =
            peer.getProtocolProvider().getOperationSet(OperationSetBasicTelephony.class);

        telephony.hangupCallPeer(
            peer,
            OperationSetBasicTelephony.HANGUP_REASON_ENCRYPTION_REQUIRED,
            "Encryption Required!");
      } catch (OperationFailedException ex) {
        Logger.getLogger(getClass()).error("Failed to hangup peer", ex);
      }
    }
  }