diff --git a/src/net/java/sip/communicator/impl/protocol/sip/CallPeerSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/CallPeerSipImpl.java index f1c6d1613..eaccbcd05 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/CallPeerSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/CallPeerSipImpl.java @@ -360,7 +360,10 @@ public Contact getContact() = (OperationSetPresenceSipImpl) pps .getOperationSet(OperationSetPresence.class); - return opSetPresence.resolveContactID(getAddress()); + if(opSetPresence != null) + return opSetPresence.resolveContactID(getAddress()); + else + return null; } /** diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java index d1eb25e98..7c73fa43a 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java @@ -1298,10 +1298,12 @@ private void processRefer(ServerTransaction serverTransaction, (OperationSetPresenceSipImpl) protocolProvider .getOperationSet(OperationSetPersistentPresence.class); - Contact from = opSetPersPresence.resolveContactID( - fromHeader.getAddress().getURI().toString()); + Contact from = null; + if(opSetPersPresence != null) + from = opSetPersPresence.resolveContactID( + fromHeader.getAddress().getURI().toString()); - if (from == null) + if (from == null && opSetPersPresence != null) { if (logger.isDebugEnabled()) logger.debug("received a message from an unknown contact: " @@ -1313,8 +1315,17 @@ private void processRefer(ServerTransaction serverTransaction, // found no call we must authorise this with user // if user don't want it, decline it. - if(!transferAuthority.processTransfer( - from, referToAddress.getURI().toString())) + boolean allowTransfer; + + if(from != null) + allowTransfer = transferAuthority.processTransfer( + from, referToAddress.getURI().toString()); + else + allowTransfer = transferAuthority.processTransfer( + fromHeader.getAddress().getURI().toString(), + referToAddress.getURI().toString()); + + if(!allowTransfer) { // send decline Response declineResponse; diff --git a/src/net/java/sip/communicator/service/protocol/TransferAuthority.java b/src/net/java/sip/communicator/service/protocol/TransferAuthority.java index 8cebd2fd5..6056c274b 100644 --- a/src/net/java/sip/communicator/service/protocol/TransferAuthority.java +++ b/src/net/java/sip/communicator/service/protocol/TransferAuthority.java @@ -23,4 +23,15 @@ public interface TransferAuthority * otherwise. */ public boolean processTransfer(Contact fromContact, String transferTo); + + /** + * Checks with user for unknown transfer. Returns true if user + * accepts and we must process the transfer, false otherwise. + * + * @param fromAddress the address initiating the transfer. + * @param transferTo the address we will be transferred to. + * @return true if transfer is allowed to process, false + * otherwise. + */ + public boolean processTransfer(String fromAddress, String transferTo); }