diff --git a/lib/logging.properties b/lib/logging.properties index ffb9d0351..f8b2c5ef2 100644 --- a/lib/logging.properties +++ b/lib/logging.properties @@ -62,7 +62,7 @@ net.sf.cindy.impl.level = SEVERE # But we want everything coming from the sip-comm net.java.sip.communicator.level = WARNING -net.java.sip.communicator.impl.contactlist.level = FINEST +net.java.sip.communicator.impl.protocol.sip.level = FINEST # For example, set the com.xyz.foo logger to only log SEVERE # messages: diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java index 54acb4907..497dcd6b4 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java @@ -16,6 +16,7 @@ import org.jivesoftware.smackx.jingle.nat.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.service.protocol.OperationSetBasicTelephony.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.impl.protocol.jabber.mediamgr.*; @@ -217,7 +218,7 @@ private CallJabberImpl createOutgoingCall(String calleeAddress) try { - // with discovered info, we can check if the remote clients + // with discovered info, we can check if the remote clients // supports telephony but not if he don't, because // a non conforming client can supports a feature // without advertising it. So we don't rely on it (for the moment) @@ -231,7 +232,7 @@ private CallJabberImpl createOutgoingCall(String calleeAddress) else { logger.info(calleeAddress + ": jingle not supported ??? "); -// +// // throw new OperationFailedException( // "Failed to create OutgoingJingleSession.\n" // + fullCalleeURI + " do not supports jingle" @@ -442,7 +443,7 @@ public void sessionRequested(JingleSessionRequest jingleSessionRequest) fireCallEvent(CallEvent.CALL_RECEIVED, call); } - + /** * Implements method sessionCreated from CreatedJingleSessionListener. * @@ -611,7 +612,7 @@ public void afterChanged(JingleNegotiator.State oldState, } /** - * Implements sessionEstablished from JingleSessionListener + * Implements sessionEstablished from JingleSessionListener * * * @param payloadType the payloadType used for media in thi session @@ -628,7 +629,7 @@ public void sessionEstablished(PayloadType payloadType, } /** - * Implements sessionDeclined from JingleSessionListener + * Implements sessionDeclined from JingleSessionListener * * @param reason why the session has been declined * @param jingleSession the declined session @@ -679,26 +680,35 @@ public void sessionClosedOnError(XMPPException ex, * @param jingleSession the session where the media is established * @param participant the participant for this media session */ - public void sessionMediaReceived(JingleSession jingleSession, + public void sessionMediaReceived(JingleSession jingleSession, String participant) { logger.info("session media received "); } - - /* - * (non-Javadoc) - * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#setSecured(net.java.sip.communicator.service.protocol.CallParticipant, boolean, net.java.sip.communicator.service.media.CallSession.SecureStatusChangeSource) + + /** + * Sets the secured state of the call session in which a specific participant + * is involved + * + * @param participant the participant who toggled (or for whom is remotely toggled) + * the secure status change for the call + * @param secured the new secure status + * @param source the source who generated the call change */ public void setSecured(CallParticipant participant, boolean secured, - OperationSetBasicTelephony.SecureStatusChangeSource source) + SecureStatusChangeSource source) { + //TODO - implement security for jabber } - - /* - * (non-Javadoc) - * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#getSecured(net.java.sip.communicator.service.protocol.CallParticipant) + + /** + * Gets the secured state of the call session in which a specific participant + * is involved + * + * @param participant the participant for who the call state is required + * @return the call state */ - public boolean getSecured(CallParticipant participant) + public boolean isSecured(CallParticipant participant) { return false; } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index c1dc88ad2..78836c893 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -80,10 +80,10 @@ public class ProtocolProviderServiceJabberImpl * In general, we add new feature(s) when we add new operation sets. * (see xep-0030 : http://www.xmpp.org/extensions/xep-0030.html#info). * Example : to tell the world that we support jingle, we simply have - * to do : + * to do : * supportedFeatures.add("http://www.xmpp.org/extensions/xep-0166.html#ns"); - * Beware there is no canonical mapping between op set and jabber features - * (op set is a SC "concept"). This means that one op set in SC can + * Beware there is no canonical mapping between op set and jabber features + * (op set is a SC "concept"). This means that one op set in SC can * correspond to many jabber features. It is also possible that there is no * jabber feature corresponding to a SC op set or again, * we can currently support some features wich do not have a specific @@ -183,7 +183,7 @@ public void register(final SecurityAuthority authority) /** * Connects and logins again to the server. - * + * * @param authReasonCode indicates the reason of the re-authentication. */ void reregister(int authReasonCode) @@ -305,23 +305,17 @@ private void connectAndLogin(SecurityAuthority authority, int reasonCode) getAccountProperties().get( ProtocolProviderFactory.SERVER_PORT); - String accountResource = (String)getAccountID(). + String accountResource = (String)getAccountID(). getAccountProperties().get( ProtocolProviderFactory.RESOURCE); // check to see is there SRV records for this server domain try { - InetSocketAddress hosts[] = - NetworkUtils.getSRVRecords( - "_xmpp-client._tcp." + serviceName); - - if(hosts != null && hosts.length > 0) - { - logger.trace("Will set server address from SRV records " - + hosts[0]); - serverAddress = hosts[0].getHostName(); - } + serverAddress = NetworkUtils + .getSRVRecord("xmpp-client", "tcp", serviceName) + .getHostName(); + } catch (ParseException ex1) { @@ -366,7 +360,7 @@ private void connectAndLogin(SecurityAuthority authority, int reasonCode) if(accountResource == null || accountResource == "") accountResource = "sip-comm"; - + connection.login(userID, password, accountResource); if(connection.isAuthenticated()) @@ -398,7 +392,7 @@ private void connectAndLogin(SecurityAuthority authority, int reasonCode) } } - // we setup supported features + // we setup supported features if (getRegistrationState() == RegistrationState.REGISTERED) { discoveryManager = ServiceDiscoveryManager. @@ -512,7 +506,7 @@ protected void initialize(String screenname, jabberIcon = new ProtocolIconJabberImpl(protocolIconPath); - jabberStatusEnum + jabberStatusEnum = JabberStatusEnum.getJabberStatusEnum(protocolIconPath); //this feature is mandatory to be compliant with Service Discovery @@ -626,7 +620,7 @@ protected void initialize(String screenname, = new OperationSetBasicTelephonyJabberImpl(this); supportedOperationSets.put( - OperationSetBasicTelephony.class.getName(), + OperationSetBasicTelephony.class.getName(), opSetBasicTelephony); supportedFeatures.add( @@ -722,7 +716,7 @@ public void connectionClosed() } /** - * Implements connectionClosedOnError from + * Implements connectionClosedOnError from * ConnectionListener. * * @param exception contains information on the error. @@ -757,7 +751,7 @@ public void reconnectionSuccessful() } /** - * Implements reconnectionFailed from + * Implements reconnectionFailed from * ConnectionListener. * * @param exception description of the failure @@ -779,7 +773,7 @@ public ProtocolIcon getProtocolIcon() /** * Returns the current instance of JabberStatusEnum. - * + * * @return the current instance of JabberStatusEnum. */ JabberStatusEnum getJabberStatusEnum() diff --git a/src/net/java/sip/communicator/impl/protocol/sip/AddressResolverImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/AddressResolverImpl.java index 4d13992cf..858f16393 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/AddressResolverImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/AddressResolverImpl.java @@ -20,6 +20,7 @@ * is constructed another dns lookup will be made for the A record. * * @author Damian Minkov + * @author Alan Kelly */ public class AddressResolverImpl implements AddressResolver @@ -31,34 +32,41 @@ public Hop resolveAddress(Hop inputAddress) { try { - String lookupStr = null; + InetSocketAddress host = null; - if(inputAddress.getTransport().equalsIgnoreCase(ListeningPoint.UDP)) - lookupStr = "_sip._udp." + inputAddress.getHost(); - else if(inputAddress.getTransport().equalsIgnoreCase(ListeningPoint.TCP)) - lookupStr = "_sip._tcp." + inputAddress.getHost(); - else if(inputAddress.getTransport().equalsIgnoreCase(ListeningPoint.TLS)) - lookupStr = "_sips._tcp." + inputAddress.getHost(); + String transport = inputAddress.getTransport(); - InetSocketAddress hosts[] = NetworkUtils.getSRVRecords(lookupStr); + if (transport == null) + transport = ListeningPoint.UDP; - if(hosts != null && hosts.length > 0) - { - logger.trace("Will set server address from SRV records " - + hosts[0]); - return new HopImpl( - hosts[0].getHostName(), - hosts[0].getPort(), - inputAddress.getTransport()); + if (transport.equalsIgnoreCase(ListeningPoint.TLS)) + { + host = NetworkUtils.getSRVRecord( + "sips", ListeningPoint.TCP, inputAddress.getHost()); + } + else + { + host = NetworkUtils.getSRVRecord( + "sip", transport, inputAddress.getHost()); } + + if(logger.isTraceEnabled()) + logger.trace("Returning hop as follows" + + " host= " + host.getHostName() + + " port= " + host.getPort() + + " transport= " + transport); + + + return new HopImpl(host.getHostName(), host.getPort(), transport); + } catch (Exception ex) { logger.error("Domain not resolved " + ex.getMessage()); } - if (inputAddress.getPort() != -1) + if (inputAddress.getPort() != -1) { return inputAddress; } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ClientCapabilities.java b/src/net/java/sip/communicator/impl/protocol/sip/ClientCapabilities.java index 609eaec81..3a8f299ba 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ClientCapabilities.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ClientCapabilities.java @@ -207,16 +207,22 @@ private long getNextCSeqValue() private void disconnect() { //don't alert the user if we're already off - if(provider.getRegistrarConnection().getRegistrationState(). - equals(RegistrationState.UNREGISTERED)) + if(provider.getRegistrationState() + .equals(RegistrationState.UNREGISTERED)) + { return; + } - provider.getRegistrarConnection().setRegistrationState( + provider.getRegistrarConnection().setRegistrationState( RegistrationState.CONNECTION_FAILED , RegistrationStateChangeEvent.REASON_NOT_SPECIFIED , "A timeout occurred while trying to connect to the server."); } + /** + * The task would continuously send OPTIONs request that we use as a keep + * alive method. + */ private class KeepAliveTask extends TimerTask { @@ -224,20 +230,22 @@ public void run() { try { + logger.logEntry(); + //From FromHeader fromHeader = null; try { fromHeader = provider.getHeaderFactory().createFromHeader( - provider.getOurSipAddress(), ProtocolProviderServiceSipImpl - .generateLocalTag()); + provider.getOurSipAddress(), + ProtocolProviderServiceSipImpl.generateLocalTag()); } catch (ParseException ex) { //this should never happen so let's just log and bail. - logger.error( - "Failed to generate a from header for our register request." - , ex); + logger.error("Failed to generate a from header for " + + "our register request." + , ex); return; } @@ -306,8 +314,8 @@ public void run() //create a host-only uri for the request uri header. String domain = ((SipURI) toHeader.getAddress().getURI()).getHost(); - SipURI requestURI - = provider.getAddressFactory().createSipURI(null,domain); + SipURI requestURI = provider.getAddressFactory() + .createSipURI(null, domain); request = provider.getMessageFactory().createRequest( requestURI , Request.OPTIONS @@ -317,10 +325,13 @@ public void run() , toHeader , viaHeaders , maxForwardsHeader); + + if (logger.isDebugEnabled()) + logger.debug("Created OPTIONS request " + request); } catch (ParseException ex) { - logger.error("Could not create the register request!", ex); + logger.error("Could not create an OPTIONS request!", ex); return; } @@ -362,7 +373,8 @@ public void run() //Contact Header (should contain IP) ContactHeader contactHeader = provider.getContactHeader( - destinationInetAddress, provider.getDefaultListeningPoint()); + destinationInetAddress, + provider.getDefaultListeningPoint()); request.addHeader(contactHeader); @@ -370,14 +382,14 @@ public void run() ClientTransaction optionsTrans = null; try { - optionsTrans = provider.getDefaultJainSipProvider(). - getNewClientTransaction(request); + optionsTrans = provider.getDefaultJainSipProvider() + .getNewClientTransaction(request); } catch (TransactionUnavailableException ex) { logger.error("Could not create a register transaction!\n" - + "Check that the Registrar address is correct!", - ex); + + "Check that the Registrar address is correct!", + ex); return; } try @@ -434,6 +446,7 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) getAccountProperties(). get(ProtocolProviderServiceSipImpl.KEEP_ALIVE_METHOD); + logger.trace("Keep alive method " + keepAliveMethod); if(keepAliveMethod == null || !keepAliveMethod.equalsIgnoreCase("options")) return; @@ -442,12 +455,14 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) getAccountProperties(). get(ProtocolProviderServiceSipImpl.KEEP_ALIVE_INTERVAL); + logger.trace("Keep alive inerval is " + keepAliveIntStr); if(keepAliveIntStr != null) { int keepAliveInterval = -1; try { - keepAliveInterval = Integer.valueOf(keepAliveIntStr).intValue(); + keepAliveInterval = Integer.valueOf(keepAliveIntStr) + .intValue(); } catch (Exception ex) { @@ -459,6 +474,8 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) if(keepAliveTimer == null) keepAliveTimer = new Timer(); + logger.debug("Scheduling OPTIONS keep alives"); + keepAliveTimer.schedule( new KeepAliveTask(), 0, keepAliveInterval * 1000); } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/MethodProcessor.java b/src/net/java/sip/communicator/impl/protocol/sip/MethodProcessor.java index 9b864c734..df6de3c6c 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/MethodProcessor.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/MethodProcessor.java @@ -14,7 +14,7 @@ * with the addition of signaling whether the specified event was indeed handled * in the processor and needs no further processing in other processors * registered for the same method. - * + * * @author Lubomir Marinov */ public interface MethodProcessor @@ -25,7 +25,7 @@ public interface MethodProcessor * transitions to the Terminated state, the stack keeps no further records * of the dialog. This notification can be used by applications to clean up * any auxiliary data that is being maintained for the given dialog. - * + * * @param dialogTerminatedEvent an event that indicates that the dialog has * transitioned into the terminated state * @return true if the specified event has been handled by this @@ -41,7 +41,7 @@ public interface MethodProcessor * to the application immediately (according to RFC 3261). This method * enables an implementation to propagate the asynchronous handling of IO * Exceptions to the application. - * + * * @param exceptionEvent the Exception event that is reported to the * application * @return true if the specified event has been handled by this @@ -54,7 +54,7 @@ public interface MethodProcessor * Processes a Request received on a * ProtocolProviderServiceSipImpl upon which this processor is * registered. - * + * * @param requestEvent requestEvent fired from the * ProtocolProviderServiceSipImpl to the processor * representing a Request received from the network @@ -68,7 +68,7 @@ public interface MethodProcessor * Processes a Response received on a * ProtocolProviderServiceSipImpl upon which this processor is * registered. - * + * * @param responseEvent the responseEvent fired from the * ProtocolProviderServiceSipImpl to the processor * representing a Response received from the network @@ -87,7 +87,7 @@ public interface MethodProcessor * server upon which the timeout occurred. The type of Timeout can by * determined by: * timeoutType = timeoutEvent.getTimeout().getValue(); - * + * * @param timeoutEvent the timeoutEvent received indicating either the * message retransmit or transaction timed out * @return true if the specified event has been handled by this @@ -102,7 +102,7 @@ public interface MethodProcessor * further records of the transaction. This notification can be used by * applications to clean up any auxiliary data that is being maintained for * the given transaction. - * + * * @param transactionTerminatedEvent an event that indicates that the * transaction has transitioned into the terminated state * @return true if the specified event has been handled by this 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 9a85c7a3e..b1d9b0077 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java @@ -2555,7 +2555,7 @@ private boolean sayBye(CallParticipantSipImpl callParticipant) ArrayList viaHeaders = protocolProvider.getLocalViaHeaders(destinationInetAddress, protocolProvider.getRegistrarConnection() - .getRegistrarListeningPoint()); + .getListeningPoint()); bye.setHeader((ViaHeader) viaHeaders.get(0)); bye.addHeader(protocolProvider.getSipCommUserAgentHeader()); } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java index 170a9878a..89d49ac3a 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java @@ -1673,7 +1673,7 @@ public void unsubscribe(Contact contact) /** * Analyzes the incoming responseEvent and then forwards it to the * proper event handler. - * + * * @param responseEvent the responseEvent that we received * ProtocolProviderService. * @return true if the specified event has been handled by this @@ -2438,7 +2438,7 @@ private ClientTransaction createNotify(ContactSipImpl contact, byte[] doc, /** * Process a request from a distant contact - * + * * @param requestEvent the RequestEvent containing the newly * received request. * @return true if the specified event has been handled by this @@ -2988,7 +2988,7 @@ public boolean processRequest(RequestEvent requestEvent) /** * Called when a dialog is terminated - * + * * @param dialogTerminatedEvent DialogTerminatedEvent * @return true if the specified event has been handled by this * processor and shouldn't be offered to other processors registered @@ -3003,7 +3003,7 @@ public boolean processDialogTerminated( /** * Called when an IO error occurs - * + * * @param exceptionEvent IOExceptionEvent * @return true if the specified event has been handled by this * processor and shouldn't be offered to other processors registered @@ -3017,7 +3017,7 @@ public boolean processIOException(IOExceptionEvent exceptionEvent) /** * Called when a transaction is terminated - * + * * @param transactionTerminatedEvent TransactionTerminatedEvent * @return true if the specified event has been handled by this * processor and shouldn't be offered to other processors registered @@ -3032,7 +3032,7 @@ public boolean processTransactionTerminated( /** * Called when a timeout occur - * + * * @param timeoutEvent TimeoutEvent * @return true if the specified event has been handled by this * processor and shouldn't be offered to other processors registered diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index e4d2aef70..19f95fdba 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -30,6 +30,7 @@ * * @author Emil Ivov * @author Lubomir Marinov + * @author Alan Kelly */ public class ProtocolProviderServiceSipImpl extends AbstractProtocolProviderService @@ -1531,7 +1532,7 @@ public ContactHeader getContactHeader() { genericContactHeader = getContactHeader( sipRegistrarConnection.getRegistrarAddress(), - sipRegistrarConnection.getRegistrarListeningPoint()); + sipRegistrarConnection.getListeningPoint()); } catch(OperationFailedException ex) { @@ -1959,22 +1960,10 @@ private void initOutboundProxy(SipAccountID accountID, if(proxyTransport == null) proxyTransport = getDefaultTransport(); - if(proxyTransport.equalsIgnoreCase(ListeningPoint.UDP)) - lookupStr = "_sip._udp." + proxyAddressStr; - else if(proxyTransport.equalsIgnoreCase(ListeningPoint.TCP)) - lookupStr = "_sip._tcp." + proxyAddressStr; - else if(proxyTransport.equalsIgnoreCase(ListeningPoint.TLS)) - lookupStr = "_sips._tcp." + proxyAddressStr; + proxyAddressStr = resolveSipAddress( + proxyAddressStr, proxyTransport).getHostName(); - InetSocketAddress hosts[] = NetworkUtils.getSRVRecords(lookupStr); - - if(hosts != null && hosts.length > 0) - { - logger.trace("Will set server address from SRV records " - + hosts[0]); - - proxyAddressStr = hosts[0].getHostName(); - } + logger.trace("Setting proxy address = " + proxyAddressStr); } catch (Exception ex) { @@ -2170,12 +2159,18 @@ public void unregisterMethodProcessor(String method, * DEFAULT_TRANSPORT property and return it if not null. Otherwise the * method would return UDP; * - * @return The first non null password of the following: a) the transport - * of our outbound proxy, b) the transport specified by the - * DEFAULT_TRANSPORT property, c) UDP. + * @return The first non null password of the following: + * a) the transport we use to communicate with our registrar + * b) the transport of our outbound proxy, + * c) the transport specified by the DEFAULT_TRANSPORT property, UDP. */ public String getDefaultTransport() { + SipRegistrarConnection srConnection = getRegistrarConnection(); + + if(srConnection != null) + return srConnection.getTransport(); + if(outboundProxySocketAddress != null && outboundProxyTransport != null) { diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipRegistrarConnection.java b/src/net/java/sip/communicator/impl/protocol/sip/SipRegistrarConnection.java index 9a54a589d..6ce6a9a96 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/SipRegistrarConnection.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/SipRegistrarConnection.java @@ -149,7 +149,7 @@ public SipRegistrarConnection(InetAddress registrarAddress, } /** - * Empty constructor that we only have in order to allow for classes like + * Empty constructor that we only have in order to allow for classes like * SipRegistrarlessConnection to extend this class. */ protected SipRegistrarConnection() @@ -195,7 +195,7 @@ void register() //Call ID Header CallIdHeader callIdHeader - = this.getRegistrarJainSipProvider().getNewCallId(); + = this.getJainSipProvider().getNewCallId(); //CSeq Header CSeqHeader cSeqHeader = null; @@ -257,7 +257,7 @@ void register() //Via Headers ArrayList viaHeaders = sipProvider.getLocalViaHeaders( - registrarAddress, getRegistrarListeningPoint()); + registrarAddress, getListeningPoint()); //MaxForwardsHeader MaxForwardsHeader maxForwardsHeader = sipProvider. @@ -348,7 +348,7 @@ void register() //Contact Header (should contain IP) ContactHeader contactHeader = sipProvider.getContactHeader( - registrarAddress, getRegistrarListeningPoint()); + registrarAddress, getListeningPoint()); //add expires in the contact header as well in case server likes it //better there. @@ -370,7 +370,7 @@ void register() //Transaction try { - regTrans = getRegistrarJainSipProvider().getNewClientTransaction( + regTrans = getJainSipProvider().getNewClientTransaction( request); } @@ -635,7 +635,7 @@ private void unregister(boolean sendUnregister) throws OperationFailedException try { unregisterTransaction = - this.getRegistrarJainSipProvider().getNewClientTransaction( + this.getJainSipProvider().getNewClientTransaction( unregisterRequest); } catch (TransactionUnavailableException ex) @@ -861,7 +861,7 @@ public InetAddress getRegistrarAddress() * @return the listening point that should be used for communication with our * current registrar. */ - ListeningPoint getRegistrarListeningPoint() + ListeningPoint getListeningPoint() { return sipProvider.getListeningPoint(registrarURI.getTransportParam()); } @@ -873,15 +873,26 @@ ListeningPoint getRegistrarListeningPoint() * @return the JAIN SIP provider that should be used for communication with * our current registrar. */ - private SipProvider getRegistrarJainSipProvider() + public SipProvider getJainSipProvider() { - return sipProvider.getJainSipProvider(registrarURI.getTransportParam()); + return sipProvider.getJainSipProvider(getTransport()); + } + + /** + * Returns the transport that this connection is currently using to + * communicate with the Registrar. + * + * @return the transport that this connection is using. + */ + public String getTransport() + { + return registrarURI.getTransportParam(); } /** * Analyzes the incoming responseEvent and then forwards it to the * proper event handler. - * + * * @param responseEvent the responseEvent that we received * ProtocolProviderService. * @return true if the specified event has been handled by this @@ -1060,7 +1071,7 @@ private void processForbidden( * transitions to the Terminated state, the stack keeps no further records * of the dialog. This notification can be used by applications to clean up * any auxiliary data that is being maintained for the given dialog. - * + * * @param dialogTerminatedEvent -- an event that indicates that the dialog * has transitioned into the terminated state. * @return true if the specified event has been handled by this @@ -1078,7 +1089,7 @@ public boolean processDialogTerminated(DialogTerminatedEvent * Processes a Request received on a SipProvider upon which this SipListener * is registered. *

- * + * * @param requestEvent requestEvent fired from the SipProvider to the * SipListener representing a Request received from the network. * @return true if the specified event has been handled by this @@ -1094,7 +1105,7 @@ public boolean processRequest(RequestEvent requestEvent) /** * Processes a retransmit or expiration Timeout of an underlying * {@link Transaction}handled by this SipListener. - * + * * @param timeoutEvent the timeoutEvent received indicating either the * message retransmit or transaction timed out. * @return true if the specified event has been handled by this @@ -1117,7 +1128,7 @@ public boolean processTimeout(TimeoutEvent timeoutEvent) * Process an asynchronously reported TransactionTerminatedEvent. When a * transaction transitions to the Terminated state, the stack keeps no * further records of the transaction. - * + * * @param transactionTerminatedEvent an event that indicates that the * transaction has transitioned into the terminated state. * @return true if the specified event has been handled by this @@ -1133,7 +1144,7 @@ public boolean processTransactionTerminated(TransactionTerminatedEvent /** * Process an asynchronously reported IO Exception. - * + * * @param exceptionEvent The Exception event that is reported to the * application. * @return true if the specified event has been handled by this diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipRegistrarlessConnection.java b/src/net/java/sip/communicator/impl/protocol/sip/SipRegistrarlessConnection.java index 1f7a28b3a..8934c341c 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/SipRegistrarlessConnection.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/SipRegistrarlessConnection.java @@ -154,7 +154,7 @@ public InetAddress getRegistrarAddress() * current registrar. */ @Override - public ListeningPoint getRegistrarListeningPoint() + public ListeningPoint getListeningPoint() { return sipProvider.getDefaultListeningPoint(); } diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java index 3a97ab886..e95ae6f67 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java @@ -1,6 +1,6 @@ /* * 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.plugin.sipaccregwizz; @@ -18,7 +18,7 @@ /** * The FirstWizardPage is the page, where user could enter the uin * and the password of the account. - * + * * @author Yana Stamcheva * @author Damian Minkov */ @@ -136,8 +136,8 @@ public class FirstWizardPage private JComboBox keepAliveMethodBox = new JComboBox(new Object [] { - Resources.getString("register").toUpperCase(), - Resources.getString("options").toUpperCase() + "REGISTER", + "OPTIONS" }); private JTextField keepAliveIntervalValue = new JTextField(); @@ -154,7 +154,7 @@ public class FirstWizardPage /** * Creates an instance of FirstWizardPage. - * + * * @param wizard the parent wizard */ public FirstWizardPage(SIPAccountRegistrationWizard wizard) @@ -392,11 +392,11 @@ public void pageShowing() public void commitPage() { String uin = uinField.getText(); - int indexOfSeparator = uin.indexOf('@'); + int indexOfSeparator = uin.indexOf('@'); if (indexOfSeparator > -1) { uin = uin.substring(0, indexOfSeparator); } - + String server = serverField.getText(); if (!wizard.isModification() && isExistingAccount(uin, server)) @@ -496,7 +496,7 @@ public void pageBack() /** * Fills the UIN and Password fields in this panel with the data coming from * the given protocolProvider. - * + * * @param protocolProvider The ProtocolProviderService to load * the data from. */ @@ -553,7 +553,7 @@ public void loadAccount(ProtocolProviderService protocolProvider) uinField.setEnabled(false); this.uinField.setText(accountID.getUserID() + "@" + serverAddress); - + if (password != null) { this.passField.setText(password); @@ -600,7 +600,7 @@ public void loadAccount(ProtocolProviderService protocolProvider) pollPeriodField.setEnabled(false); subscribeExpiresField.setEnabled(false); } - + keepAliveMethodBox.setSelectedItem(keepAliveMethod); keepAliveIntervalValue.setText(keepAliveInterval); } @@ -668,12 +668,12 @@ private boolean isExistingAccount(String accountName, String serverName) } return false; } - + public Object getSimpleForm() { return uinPassPanel; } - + public boolean isCommitted() { return isCommitted; diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java index 7c1308c8a..67e9ca841 100755 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java @@ -1,6 +1,6 @@ /* * 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.plugin.sipaccregwizz; @@ -8,7 +8,7 @@ /** * The SIPAccountRegistration is used to store all user input data * through the SIPAccountRegistrationWizard. - * + * * @author Yana Stamcheva */ public class SIPAccountRegistration @@ -23,8 +23,7 @@ public class SIPAccountRegistration public static String DEFAULT_SUBSCRIBE_EXPIRES = "3600"; - public static String DEFAULT_KEEP_ALIVE_METHOD - = Resources.getString("register"); + public static String DEFAULT_KEEP_ALIVE_METHOD = "REGISTER"; public static String DEFAULT_KEEP_ALIVE_INTERVAL = "25"; @@ -78,7 +77,7 @@ public void setProxy(String proxy) /** * Returns the password of the sip registration account. - * + * * @return the password of the sip registration account. */ public String getPassword() @@ -88,7 +87,7 @@ public String getPassword() /** * Sets the password of the sip registration account. - * + * * @param password the password of the sip registration account. */ public void setPassword(String password) @@ -98,7 +97,7 @@ public void setPassword(String password) /** * Returns TRUE if password has to remembered, FALSE otherwise. - * + * * @return TRUE if password has to remembered, FALSE otherwise */ public boolean isRememberPassword() @@ -108,7 +107,7 @@ public boolean isRememberPassword() /** * Sets the rememberPassword value of this sip account registration. - * + * * @param rememberPassword TRUE if password has to remembered, FALSE * otherwise */ @@ -119,7 +118,7 @@ public void setRememberPassword(boolean rememberPassword) /** * Returns the UIN of the sip registration account. - * + * * @return the UIN of the sip registration account. */ public String getId() @@ -129,7 +128,7 @@ public String getId() /** * The address of the server we will use for this account - * + * * @return String */ public String getServerAddress() @@ -139,7 +138,7 @@ public String getServerAddress() /** * The port on the specified server - * + * * @return int */ public String getServerPort() @@ -149,7 +148,7 @@ public String getServerPort() /** * The port on the specified proxy - * + * * @return int */ public String getProxyPort() @@ -159,7 +158,7 @@ public String getProxyPort() /** * Sets the identifier of the sip registration account. - * + * * @param uin the identifier of the sip registration account. */ public void setId(String id) @@ -169,7 +168,7 @@ public void setId(String id) /** * Sets the server - * + * * @param serverAddress String */ public void setServerAddress(String serverAddress) @@ -179,7 +178,7 @@ public void setServerAddress(String serverAddress) /** * Sets the server port. - * + * * @param port int */ public void setServerPort(String port) @@ -189,7 +188,7 @@ public void setServerPort(String port) /** * Sets the proxy port. - * + * * @param port int */ public void setProxyPort(String port) @@ -199,7 +198,7 @@ public void setProxyPort(String port) /** * If the presence is enabled - * + * * @return If the presence is enabled */ public boolean isEnablePresence() @@ -209,7 +208,7 @@ public boolean isEnablePresence() /** * If the p2p mode is forced - * + * * @return If the p2p mode is forced */ public boolean isForceP2PMode() @@ -219,7 +218,7 @@ public boolean isForceP2PMode() /** * The offline contact polling period - * + * * @return the polling period */ public String getPollingPeriod() @@ -229,7 +228,7 @@ public String getPollingPeriod() /** * The default expiration of subscriptions - * + * * @return the subscription expiration */ public String getSubscriptionExpiration() @@ -239,7 +238,7 @@ public String getSubscriptionExpiration() /** * Sets if the presence is enabled - * + * * @param enablePresence if the presence is enabled */ public void setEnablePresence(boolean enablePresence) @@ -249,7 +248,7 @@ public void setEnablePresence(boolean enablePresence) /** * Sets if we have to force the p2p mode - * + * * @param forceP2PMode if we have to force the p2p mode */ public void setForceP2PMode(boolean forceP2PMode) @@ -259,7 +258,7 @@ public void setForceP2PMode(boolean forceP2PMode) /** * Sets the offline contacts polling period - * + * * @param pollingPeriod the offline contacts polling period */ public void setPollingPeriod(String pollingPeriod) @@ -269,7 +268,7 @@ public void setPollingPeriod(String pollingPeriod) /** * Sets the subscription expiration value - * + * * @param subscriptionExpiration the subscription expiration value */ public void setSubscriptionExpiration(String subscriptionExpiration) @@ -279,7 +278,7 @@ public void setSubscriptionExpiration(String subscriptionExpiration) /** * Returns the keep alive method. - * + * * @return the keep alive method. */ public String getKeepAliveMethod() @@ -289,7 +288,7 @@ public String getKeepAliveMethod() /** * Sets the keep alive method. - * + * * @param keepAliveMethod the keep alive method to set */ public void setKeepAliveMethod(String keepAliveMethod) @@ -299,7 +298,7 @@ public void setKeepAliveMethod(String keepAliveMethod) /** * Returns the keep alive interval. - * + * * @return the keep alive interval */ public String getKeepAliveInterval() @@ -309,7 +308,7 @@ public String getKeepAliveInterval() /** * Sets the keep alive interval. - * + * * @param keepAliveInterval the keep alive interval to set */ public void setKeepAliveInterval(String keepAliveInterval) diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetBasicTelephony.java b/src/net/java/sip/communicator/service/protocol/OperationSetBasicTelephony.java index 2959837d2..6d0a7d81f 100644 --- a/src/net/java/sip/communicator/service/protocol/OperationSetBasicTelephony.java +++ b/src/net/java/sip/communicator/service/protocol/OperationSetBasicTelephony.java @@ -166,5 +166,5 @@ public void setSecured(CallParticipant participant, boolean secured, * @param participant the participant for who the call state is required * @return the call state */ - public boolean getSecured(CallParticipant participant); + public boolean isSecured(CallParticipant participant); }