Add timeout property. Try call anyway on timeout so popup appears.

fix-message-formatting
Daniel Pocock 11 years ago
parent 6b1f3bbdb3
commit daec4acdc2

@ -26,6 +26,20 @@
public class UriHandlerSipImpl
implements UriHandler, ServiceListener, AccountManagerListener
{
/**
* Property to set the amount of time to wait for SIP registration
* to complete before trying to dial a URI from the command line.
* (value in milliseconds).
*/
public static final String INITIAL_REGISTRATION_TIMEOUT_PROP
= "net.java.sip.communicator.impl.protocol.sip.call.INITIAL_REGISTRATION_TIMEOUT";
/**
* Default value for INITIAL_REGISTRATION_TIMEOUT (milliseconds)
*/
public static final long DEFAULT_INITIAL_REGISTRATION_TIMEOUT
= 2000;
/**
* The <tt>Logger</tt> used by the <tt>UriHandlerSipImpl</tt> class and its
* instances for logging output.
@ -258,7 +272,7 @@ public String getProtocol()
*
* @param uri the SIP URI that we have to call.
*/
public void handleUri(String uri)
public void handleUri(final String uri)
{
/*
* TODO If the requirement to register the factory service after
@ -308,6 +322,10 @@ public void handleUri(String uri)
{
// Allow a grace period for the provider to register in case
// we have just started up
long initialRegistrationTimeout =
SipActivator.getConfigurationService()
.getLong(INITIAL_REGISTRATION_TIMEOUT_PROP,
DEFAULT_INITIAL_REGISTRATION_TIMEOUT);
final DelayRegistrationStateChangeListener listener =
new DelayRegistrationStateChangeListener(uri, provider);
provider.addRegistrationStateChangeListener(listener);
@ -317,8 +335,12 @@ public void handleUri(String uri)
public void run()
{
provider.removeRegistrationStateChangeListener(listener);
// Even if not registered after the timeout, try the call
// anyway and the error popup will appear to ask the
// user if they want to register
handleUri(uri, provider);
}
}, 2000);
}, initialRegistrationTimeout);
}
}

Loading…
Cancel
Save