Fixes some NPE when sip presence is disabled.

cusax-fix
Damian Minkov 14 years ago
parent 97f00d4a43
commit d8f18d4b77

@ -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;
}
/**

@ -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;

@ -23,4 +23,15 @@ public interface TransferAuthority
* otherwise.
*/
public boolean processTransfer(Contact fromContact, String transferTo);
/**
* Checks with user for unknown transfer. Returns <tt>true</tt> if user
* accepts and we must process the transfer, <tt>false</tt> otherwise.
*
* @param fromAddress the address initiating the transfer.
* @param transferTo the address we will be transferred to.
* @return <tt>true</tt> if transfer is allowed to process, <tt>false</tt>
* otherwise.
*/
public boolean processTransfer(String fromAddress, String transferTo);
}

Loading…
Cancel
Save