Merge pull request #51 from dpocock/sip-call-without-registration

Adapt high-level API to allow calls without registration
smack4
Ingo Bauersachs 10 years ago
commit 30332994f3

@ -2181,7 +2181,8 @@ private Address parseAddressString(String addressString)
void assertRegistered()
throws OperationFailedException
{
if(!protocolProvider.isRegistered())
if(protocolProvider.isRegistrationRequiredForCalling() &&
!protocolProvider.isRegistered())
{
throw new OperationFailedException(
"The protocol provider should be registered before placing"

@ -245,6 +245,19 @@ public AccountID getAccountID()
return accountID;
}
/**
* Indicates whether or not this provider must registered
* when placing outgoing calls.
*
* @return <tt>true</tt> if the provider must be registered when placing a
* call and <tt>false</tt> otherwise.
*/
public boolean isRegistrationRequiredForCalling()
{
return getAccountID().getAccountPropertyBoolean(
ProtocolProviderFactory.MUST_REGISTER_TO_CALL, true);
}
/**
* Returns the state of the registration of this protocol provider with the
* corresponding registration service.

@ -314,6 +314,18 @@ public boolean isRegistered()
return getRegistrationState().equals(RegistrationState.REGISTERED);
}
/**
* Indicates whether or not this provider must registered
* when placing outgoing calls.
*
* @return <tt>true</tt> if the provider must be registered when placing a
* call and <tt>false</tt> otherwise.
*/
public boolean isRegistrationRequiredForCalling()
{
return true;
}
/**
* Removes the specified registration state change listener so that it does
* not receive any further notifications upon changes of the

@ -184,6 +184,12 @@ public abstract class ProtocolProviderFactory
*/
public static final String FORCE_PROXY_BYPASS = "FORCE_PROXY_BYPASS";
/**
* The name of the property that indicates whether the client must
* be registered with a registrar when making outgoing calls.
*/
public static final String MUST_REGISTER_TO_CALL = "MUST_REGISTER_TO_CALL";
/**
* The name of the property under which we store the user preference for a
* transport protocol to use (i.e. tcp or udp).

@ -102,6 +102,13 @@ public void unregister(boolean userRequest)
*/
public boolean isRegistered();
/**
* Indicates whether or not this provider must registered
* when placing outgoing calls.
* @return true if the provider must be registered when placing a call.
*/
public boolean isRegistrationRequiredForCalling();
/**
* Returns the state of the registration of this protocol provider with the
* corresponding registration service.

Loading…
Cancel
Save