diff --git a/resources/install/logging.properties b/resources/install/logging.properties
index 68577f54b..d8aad91f7 100644
--- a/resources/install/logging.properties
+++ b/resources/install/logging.properties
@@ -24,10 +24,10 @@ handlers= net.java.sip.communicator.util.FileHandler, java.util.logging.ConsoleH
# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers. For any given facility this global level
-# can be overriden by a facility specific level
+# can be overridden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
-.level= FINEST
+.level= INFO
############################################################
# Handler specific properties.
@@ -51,24 +51,6 @@ java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLo
# Provides extra control for each logger.
############################################################
-# We don't want trace logs from joscar and joustsim
-net.kano.level = INFO
-
-# We don't want trace logs from java-jml
-net.sf.cindy.impl.level = INFO
-
-# But we want everything coming from the sip-comm
-net.java.sip.communicator.impl.level = INFO
-net.java.sip.communicator.impl.contactlist.level = FINEST
-net.java.sip.communicator.slick.level = FINEST
-net.java.sip.communicator.impl.level = FINEST
-net.java.sip.communicator.service.level = FINEST
-net.java.sip.communicator.util.level = FINEST
-net.java.sip.communicator.service.configuration.level = FINEST
-net.java.sip.communicator.impl.configuration.level = FINEST
-net.java.sip.communicator.impl.history.level = INFO
-net.java.sip.communicator.impl.gui.level = INFO
-
# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
com.xyz.foo.level = SEVERE
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 a9b190efc..b7bea3d93 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
@@ -62,6 +62,12 @@ public class OperationSetBasicTelephonySipImpl
private final ActiveCallsRepositorySipImpl activeCallsRepository =
new ActiveCallsRepositorySipImpl(this);
+ /**
+ * Transfer authority interacts with user to inform for incoming
+ * REFERS for unknown calls.
+ */
+ private TransferAuthority transferAuthority = null;
+
/**
* Creates a new instance and adds itself as an INVITE method
* handler in the creating protocolProvider.
@@ -1051,8 +1057,88 @@ private void processRefer(ServerTransaction serverTransaction,
return;
}
- //Send Accepted
final Dialog dialog = serverTransaction.getDialog();
+
+ CallPeerSipImpl callPeer = activeCallsRepository.findCallPeer(dialog);
+
+ if(callPeer == null)
+ {
+ // if we are missing transfer authority to inform user, just
+ // drop thi request cause possible attempt to compromise us.
+ if(transferAuthority == null)
+ {
+ // ignore request and terminate transaction
+ logger.warn("Ignoring REFER request without call for request:"
+ + referRequest);
+ try
+ {
+ serverTransaction.terminate();
+ }
+ catch (Throwable e)
+ {
+ logger.warn("Failed to properly terminate transaction for "
+ +"a rogue request. Well ... so be it "
+ + "Request:" + referRequest);
+ }
+
+ return;
+ }
+
+ FromHeader fromHeader =
+ (FromHeader)referRequest.getHeader(FromHeader.NAME);
+
+ OperationSetPresenceSipImpl opSetPersPresence =
+ (OperationSetPresenceSipImpl) protocolProvider
+ .getOperationSet(OperationSetPersistentPresence.class);
+
+ Contact from = opSetPersPresence.resolveContactID(
+ fromHeader.getAddress().getURI().toString());
+
+ if (from == null)
+ {
+ if (logger.isDebugEnabled())
+ logger.debug("received a message from an unknown contact: "
+ + fromHeader.getAddress().getURI().toString());
+ //create the volatile contact
+ from = opSetPersPresence.createVolatileContact(
+ fromHeader.getAddress().getURI().toString());
+ }
+
+ // found no call we must authorise this with user
+ // if user don't want it, decline it.
+ if(!transferAuthority.processTransfer(
+ from, referToAddress.getURI().toString()))
+ {
+ // send decline
+ Response declineResponse;
+ try
+ {
+ declineResponse = protocolProvider.getMessageFactory()
+ .createResponse(
+ Response.DECLINE,
+ referRequest);
+ }
+ catch (ParseException e)
+ {
+ logger.error("Error while creating 603 response", e);
+ return;
+ }
+
+ try
+ {
+ serverTransaction.sendResponse(declineResponse);
+ }
+ catch (Exception e)
+ {
+ logger.error("Error while sending the response 603", e);
+ return;
+ }
+
+ return;
+ }
+ }
+
+ //Send Accepted
Response accepted = null;
try
{
@@ -1137,9 +1223,6 @@ private void processRefer(ServerTransaction serverTransaction,
// Before creating the outgoing call to the refer address we change
// the call state of the refer peer to referred.
- CallPeerSipImpl callPeer = activeCallsRepository.findCallPeer(
- serverTransaction.getDialog());
-
if (callPeer != null)
callPeer.setState(CallPeerState.REFERRED);
@@ -1831,4 +1914,14 @@ private boolean isRemoteControlNotification(Request request)
return false;
}
+
+ /**
+ * Transfer authority used for interacting with user for unknown calls
+ * and the requests for transfer.
+ * @param authority transfer authority.
+ */
+ public void setTransferAuthority(TransferAuthority authority)
+ {
+ this.transferAuthority = authority;
+ }
}
diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetAdvancedTelephony.java b/src/net/java/sip/communicator/service/protocol/OperationSetAdvancedTelephony.java
index 6ef5d6d31..753256e6f 100644
--- a/src/net/java/sip/communicator/service/protocol/OperationSetAdvancedTelephony.java
+++ b/src/net/java/sip/communicator/service/protocol/OperationSetAdvancedTelephony.java
@@ -53,4 +53,12 @@ void transfer(CallPeer peer, CallPeer target)
*/
void transfer(CallPeer peer, String target)
throws OperationFailedException;
+
+ /**
+ * Transfer authority used for interacting with user for unknown
+ * call transfer requests.
+ * @param authority transfer authority asks user for accepting a particular
+ * transfer request.
+ */
+ public void setTransferAuthority(TransferAuthority authority);
}
diff --git a/src/net/java/sip/communicator/service/protocol/TransferAuthority.java b/src/net/java/sip/communicator/service/protocol/TransferAuthority.java
new file mode 100644
index 000000000..7d75029f4
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/TransferAuthority.java
@@ -0,0 +1,26 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.protocol;
+
+/**
+ * Interacts with user for received transfer request for unknown calls.
+ *
+ * @author Damian Minkov
+ */
+public interface TransferAuthority
+{
+ /**
+ * Checks with user for unknown transfer. Returns true if user
+ * accepts and we must process the transfer, false otherwise.
+ *
+ * @param fromContact the contact 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(Contact fromContact, String transferTo);
+}