|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.service.protocol.AbstractProtocolProviderService
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl
public class ProtocolProviderServiceSipImpl
A SIP implementation of the Protocol Provider Service.
| Nested Class Summary | |
|---|---|
protected class |
ProtocolProviderServiceSipImpl.ShutdownThread
The thread that we use in order to send our unREGISTER request upon system shut down. |
| Field Summary | |
|---|---|
static String |
KEEP_ALIVE_INTERVAL
The interval for keep-alive |
static String |
KEEP_ALIVE_METHOD
Keep-alive method can be - register,options or udp |
static String |
PRES_CONTENT_IMAGE_NAME
Presence content for image. |
static String |
XCAP_ENABLE
The name of the property under which the user may specify whether to use or not XCAP. |
static String |
XCAP_PASSWORD
The name of the property under which the user may specify the XCAP user password. |
static String |
XCAP_SERVER_URI
The name of the property under which the user may specify the XCAP server uri. |
static String |
XCAP_USE_SIP_CREDETIALS
The name of the property under which the user may specify whether to use original sip creadetials for the XCAP. |
static String |
XCAP_USER
The name of the property under which the user may specify the XCAP user. |
| Fields inherited from interface net.java.sip.communicator.service.protocol.ProtocolProviderService |
|---|
BIND_RETRIES_DEFAULT_VALUE, BIND_RETRIES_PROPERTY_NAME |
| Constructor Summary | |
|---|---|
ProtocolProviderServiceSipImpl()
|
|
| Method Summary | ||
|---|---|---|
protected
|
addSupportedOperationSet(Class<T> opsetClass,
T opset)
Adds a specific OperationSet implementation to the set of supported OperationSets of this instance. |
|
void |
fireRegistrationStateChanged(RegistrationState oldState,
RegistrationState newState,
int reasonCode,
String reason)
Creates a RegistrationStateChange event corresponding to the specified old and new states and notifies all currently registered listeners. |
|
AccountID |
getAccountID()
Returns the AccountID that uniquely identifies the account represented by this instance of the ProtocolProviderService. |
|
javax.sip.address.AddressFactory |
getAddressFactory()
Returns the AddressFactory used to create URLs ans Address objects. |
|
static Set<ProtocolProviderServiceSipImpl> |
getAllInstances()
Returns all running instances of ProtocolProviderServiceSipImpl |
|
String |
getContactAddressCustomParamValue()
Returns null for a registraless account, a value for the contact address custom parameter otherwise. |
|
javax.sip.header.ContactHeader |
getContactHeader(javax.sip.address.Address intendedDestination)
Returns a Contact header containing a sip URI based on a localhost address. |
|
javax.sip.header.ContactHeader |
getContactHeader(javax.sip.address.SipURI intendedDestination)
Returns a Contact header containing a sip URI based on a localhost address and therefore usable in REGISTER requests only. |
|
javax.sip.SipProvider |
getDefaultJainSipProvider()
Returns the provider that corresponds to the transport returned by getDefaultTransport(). |
|
javax.sip.ListeningPoint |
getDefaultListeningPoint()
Returns the listening point that corresponds to the transport returned by getDefaultTransport(). |
|
String |
getDefaultTransport()
Returns the transport that we should use if we have no clear idea of our destination's preferred transport. |
|
javax.sip.header.HeaderFactory |
getHeaderFactory()
Returns the HeaderFactory used to create SIP message headers. |
|
InetSocketAddress |
getIntendedDestination(javax.sip.address.Address destination)
Returns the InetAddress that is most likely to be to be used as a next hop when contacting the specified destination. |
|
InetSocketAddress |
getIntendedDestination(javax.sip.address.SipURI destination)
Returns the InetAddress that is most likely to be to be used as a next hop when contacting the specified destination. |
|
InetSocketAddress |
getIntendedDestination(String host)
Returns the InetAddress that is most likely to be to be used as a next hop when contacting the specified destination. |
|
javax.sip.SipProvider |
getJainSipProvider(String transport)
Returns the default jain sip provider that we use for communication over transport. |
|
List<String> |
getKnownEventsList()
Returns the list of all the registered events for this provider. |
|
javax.sip.ListeningPoint |
getListeningPoint(javax.sip.address.Address intendedDestination)
Returns the default listening point that we should use to contact the intended destination. |
|
javax.sip.ListeningPoint |
getListeningPoint(javax.sip.address.SipURI intendedDestination)
Returns the default listening point that we should use to contact the intended destination. |
|
javax.sip.ListeningPoint |
getListeningPoint(String transport)
Returns the default listening point that we use for communication over transport. |
|
ArrayList<javax.sip.header.ViaHeader> |
getLocalViaHeaders(javax.sip.address.Address intendedDestination)
Initializes and returns an ArrayList with a single ViaHeader containing a localhost address usable with the specified sdestination. |
|
ArrayList<javax.sip.header.ViaHeader> |
getLocalViaHeaders(javax.sip.address.SipURI intendedDestination)
Initializes and returns an ArrayList with a single ViaHeader containing a localhost address usable with the specified sdestination. |
|
javax.sip.header.MaxForwardsHeader |
getMaxForwardsHeader()
Initializes and returns this provider's default maxForwardsHeader field using the value specified by MAX_FORWARDS. |
|
SipMessageFactory |
getMessageFactory()
Returns the Message Factory used to create SIP messages. |
|
String |
getOurDisplayName()
Returns the display name string that the user has set as a display name for this account. |
|
javax.sip.address.Address |
getOurSipAddress(javax.sip.address.Address intendedDestination)
Returns the SIP address of record (Display Name |
|
javax.sip.address.Address |
getOurSipAddress(javax.sip.address.SipURI intendedDestination)
Returns the SIP address of record (Display Name |
|
InetSocketAddress |
getOutboundProxy()
In case we are using an outbound proxy this method returns its address. |
|
String |
getOutboundProxyString()
In case we are using an outbound proxy this method returns a suitable string for use with Router. |
|
String |
getOutboundProxyTransport()
In case we are using an outbound proxy this method returns the transport we are using to connect to it. |
|
ProtocolIcon |
getProtocolIcon()
Returns the sip protocol icon. |
|
String |
getProtocolName()
Returns the short name of the protocol that the implementation of this provider is based upon (like SIP, Jabber, ICQ/AIM, or others for example). |
|
(package private) SipRegistrarConnection |
getRegistrarConnection()
Returns the current instance of SipRegistrarConnection. |
|
RegistrationState |
getRegistrationState()
Returns the state of the registration of this protocol provider with the corresponding registration service. |
|
javax.sip.header.UserAgentHeader |
getSipCommUserAgentHeader()
Returns a User Agent header that could be used for signing our requests. |
|
SipSecurityManager |
getSipSecurityManager()
Reurns the currently valid sip security manager that everyone should use to authenticate SIP Requests. |
|
(package private) SipStatusEnum |
getSipStatusEnum()
Returns the current instance of SipStatusEnum. |
|
List<String> |
getSupportedMethods()
Returns a List of Strings corresponding to all methods that we have a processor for. |
|
XCapClient |
getXCapClient()
Gets the XCAP client. |
|
protected void |
initialize(String sipAddress,
SipAccountID accountID)
Initializes the service implementation, and puts it in a state where it could interoperate with other services. |
|
javax.sip.address.Address |
parseAddressString(String uriStr)
Parses the the uriStr string and returns a JAIN SIP URI. |
|
void |
processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
Process an asynchronously reported DialogTerminatedEvent. |
|
void |
processIOException(javax.sip.IOExceptionEvent exceptionEvent)
Never called. |
|
void |
processRequest(javax.sip.RequestEvent requestEvent)
Processes a Request received on a SipProvider upon which this SipListener is registered. |
|
void |
processResponse(javax.sip.ResponseEvent responseEvent)
Processes a Response received on a SipProvider upon which this SipListener is registered. |
|
void |
processTimeout(javax.sip.TimeoutEvent timeoutEvent)
Processes a retransmit or expiration Timeout of an underlying Transaction handled by this SipListener. |
|
void |
processTransactionTerminated(javax.sip.TransactionTerminatedEvent transactionTerminatedEvent)
Process an asynchronously reported TransactionTerminatedEvent. |
|
void |
register(SecurityAuthority authority)
Starts the registration process. |
|
void |
registerEvent(String event)
Register a new event taken in account by this provider. |
|
void |
registerMethodProcessor(String method,
MethodProcessor methodProcessor)
Registers methodProcessor in the methorProcessors table so that it would receives all messages in a transaction initiated by a method request. |
|
void |
registrationStateChanged(RegistrationStateChangeEvent event)
Stops dispatching SIP messages to a SIP protocol provider service once it's been unregistered. |
|
protected
|
removeSupportedOperationSet(Class<T> opsetClass)
Removes an OperationSet implementation from the set of supported OperationSets for this instance. |
|
InetSocketAddress |
resolveSipAddress(String address)
Tries to resolve address into a valid InetSocketAddress using an SRV query where it exists and A/AAAA where it doesn't. |
|
InetSocketAddress |
resolveSipAddress(String address,
String transport)
Tries to resolve address into a valid InetSocketAddress using an SRV query where it exists and A/AAAA where it doesn't. |
|
void |
sayError(javax.sip.ServerTransaction serverTransaction,
int errorCode)
Send an error response with the errorCode code using serverTransaction. |
|
void |
sayErrorSilently(javax.sip.ServerTransaction serverTransaction,
int errorCode)
Send an error response with the errorCode code using serverTransaction and do not surface exceptions. |
|
void |
sendAck(javax.sip.ClientTransaction clientTransaction)
Sends an ACK request in the specified dialog. |
|
void |
sendInDialogRequest(javax.sip.SipProvider sipProvider,
javax.sip.message.Request request,
javax.sip.Dialog dialog)
Sends a specific Request through a given SipProvider as part of the conversation associated with a specific Dialog. |
|
void |
shutdown()
Makes the service implementation close all open sockets and release any resources that it might have taken and prepare for shutdown/garbage collection. |
|
static void |
throwOperationFailedException(String message,
int errorCode,
Throwable cause,
Logger logger)
Logs a specific message and associated Throwable cause as an error using the current Logger and then throws a new OperationFailedException with the message, a specific error code and the cause. |
|
void |
unregister()
Ends the registration of this protocol provider with the current registration service. |
|
void |
unregisterMethodProcessor(String method,
MethodProcessor methodProcessor)
Unregisters methodProcessor from the methorProcessors table so that it won't receive further messages in a transaction initiated by a method request. |
|
| Methods inherited from class net.java.sip.communicator.service.protocol.AbstractProtocolProviderService |
|---|
addRegistrationStateChangeListener, getOperationSet, getProtocolDisplayName, getSupportedOperationSets, isRegistered, removeRegistrationStateChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.java.sip.communicator.service.protocol.ProtocolProviderService |
|---|
hashCode |
| Field Detail |
|---|
public static final String KEEP_ALIVE_METHOD
public static final String KEEP_ALIVE_INTERVAL
public static final String XCAP_ENABLE
public static final String XCAP_USE_SIP_CREDETIALS
public static final String XCAP_SERVER_URI
public static final String XCAP_USER
public static final String XCAP_PASSWORD
public static final String PRES_CONTENT_IMAGE_NAME
| Constructor Detail |
|---|
public ProtocolProviderServiceSipImpl()
| Method Detail |
|---|
public XCapClient getXCapClient()
public AccountID getAccountID()
getAccountID in interface ProtocolProviderServicepublic RegistrationState getRegistrationState()
getRegistrationState in interface ProtocolProviderServicepublic String getProtocolName()
getProtocolName in interface ProtocolProviderServicepublic void registerEvent(String event)
event - The event to registerpublic List<String> getKnownEventsList()
public void fireRegistrationStateChanged(RegistrationState oldState,
RegistrationState newState,
int reasonCode,
String reason)
AbstractProtocolProviderService
fireRegistrationStateChanged in class AbstractProtocolProviderServiceoldState - the state that the provider had before the change
occurrednewState - the state that the provider is currently in.reasonCode - a value corresponding to one of the REASON_XXX fields
of the RegistrationStateChangeEvent class, indicating the reason for
this state transition.reason - a String further explaining the reason code or null if
no such explanation is necessary.
public void register(SecurityAuthority authority)
throws OperationFailedException
register in interface ProtocolProviderServiceauthority - the security authority that will be used for resolving
any security challenges that may be returned during the
registration or at any moment while wer're registered.
OperationFailedException - with the corresponding code it the
registration fails for some reason (e.g. a networking error or an
implementation problem).
public void unregister()
throws OperationFailedException
unregister in interface ProtocolProviderServiceOperationFailedException - with the corresponding code it the
registration fails for some reason (e.g. a networking error or an
implementation problem).
protected void initialize(String sipAddress,
SipAccountID accountID)
throws OperationFailedException,
IllegalArgumentException
sipAddress - the account id/uin/screenname of the account that we're
about to createaccountID - the identifier of the account that this protocol
provider represents.
OperationFailedException - with code INTERNAL_ERROR if we fail
initializing the SIP Stack.
IllegalArgumentException - if one or more of the account
properties have invalid values.AccountID
protected <T extends OperationSet> void addSupportedOperationSet(Class<T> opsetClass,
T opset)
AbstractProtocolProviderService.supportedOperationSets which works with class
names instead of Class and also shortens the code which performs
such additions.
addSupportedOperationSet in class AbstractProtocolProviderServiceT - the exact type of the OperationSet implementation to
be addedopsetClass - the Class of OperationSet under the
name of which the specified implementation is to be addedopset - the OperationSet implementation to be addedprotected <T extends OperationSet> void removeSupportedOperationSet(Class<T> opsetClass)
removeSupportedOperationSet in class AbstractProtocolProviderServiceT - the exact type of the OperationSet implementation to
be addedopsetClass - the Class of OperationSet under the
name of which the specified implementation is to be addedpublic void processIOException(javax.sip.IOExceptionEvent exceptionEvent)
processIOException in interface javax.sip.SipListenerexceptionEvent - the IOExceptionEvent containing the cause.public void processResponse(javax.sip.ResponseEvent responseEvent)
processResponse in interface javax.sip.SipListenerresponseEvent - the responseEvent fired from the SipProvider to the
SipListener representing a Response received from the network.public void processTimeout(javax.sip.TimeoutEvent timeoutEvent)
Transaction handled by this SipListener. This Event notifies the
application that a retransmission or transaction Timer expired in the
SipProvider's transaction state machine. The TimeoutEvent encapsulates
the specific timeout type and the transaction identifier either client or
server upon which the timeout occurred. The type of Timeout can by
determined by:
timeoutType = timeoutEvent.getTimeout().getValue();
processTimeout in interface javax.sip.SipListenertimeoutEvent - -
the timeoutEvent received indicating either the message
retransmit or transaction timed out.public void processTransactionTerminated(javax.sip.TransactionTerminatedEvent transactionTerminatedEvent)
processTransactionTerminated in interface javax.sip.SipListenertransactionTerminatedEvent - -- an event that indicates that the
transaction has transitioned into the terminated state.public void processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
processDialogTerminated in interface javax.sip.SipListenerdialogTerminatedEvent - -- an event that indicates that the
dialog has transitioned into the terminated state.public void processRequest(javax.sip.RequestEvent requestEvent)
processRequest in interface javax.sip.SipListenerrequestEvent - requestEvent fired from the SipProvider to the
SipListener representing a Request received from the network.public void shutdown()
shutdown in interface ProtocolProviderService
public ArrayList<javax.sip.header.ViaHeader> getLocalViaHeaders(javax.sip.address.Address intendedDestination)
throws OperationFailedException
intendedDestination - The address of the destination that the
request using the via headers will be sent to.
OperationFailedException - code INTERNAL_ERROR if a ParseException
occurs while initializing the array list.
public ArrayList<javax.sip.header.ViaHeader> getLocalViaHeaders(javax.sip.address.SipURI intendedDestination)
throws OperationFailedException
intendedDestination - The address of the destination that the
request using the via headers will be sent to.
OperationFailedException - code INTERNAL_ERROR if a ParseException
occurs while initializing the array list.
public javax.sip.header.MaxForwardsHeader getMaxForwardsHeader()
throws OperationFailedException
OperationFailedException - with code INTERNAL_ERROR if MAX_FORWARDS
has an invalid value.public javax.sip.header.ContactHeader getContactHeader(javax.sip.address.Address intendedDestination)
intendedDestination - the destination that we plan to be sending
this contact header to.
public javax.sip.header.ContactHeader getContactHeader(javax.sip.address.SipURI intendedDestination)
intendedDestination - the destination that we plan to be sending
this contact header to.
public String getContactAddressCustomParamValue()
public javax.sip.address.AddressFactory getAddressFactory()
public javax.sip.header.HeaderFactory getHeaderFactory()
public SipMessageFactory getMessageFactory()
public static Set<ProtocolProviderServiceSipImpl> getAllInstances()
public javax.sip.ListeningPoint getListeningPoint(String transport)
transport - the transport that the returned listening point needs
to support.
public javax.sip.ListeningPoint getListeningPoint(javax.sip.address.Address intendedDestination)
intendedDestination - the address that we will be trying to contact
through the listening point we are trying to obtain.
public javax.sip.ListeningPoint getListeningPoint(javax.sip.address.SipURI intendedDestination)
intendedDestination - the address that we will be trying to contact
through the listening point we are trying to obtain.
public javax.sip.SipProvider getJainSipProvider(String transport)
transport - the transport that the returned provider needs
to support.
public SipSecurityManager getSipSecurityManager()
public javax.sip.address.Address getOurSipAddress(javax.sip.address.Address intendedDestination)
intendedDestination - the destination that we would be using the
local address to communicate with.
public javax.sip.address.Address getOurSipAddress(javax.sip.address.SipURI intendedDestination)
intendedDestination - the destination that we would be using the
local address to communicate with.
.
public String getOutboundProxyString()
public InetSocketAddress getOutboundProxy()
public String getOutboundProxyTransport()
public void registerMethodProcessor(String method,
MethodProcessor methodProcessor)
method - a String representing the SIP method that we're registering
the processor for (e.g. INVITE, REGISTER, or SUBSCRIBE).methodProcessor - a MethodProcessor implementation that
would handle all messages received within a method
transaction.
public void unregisterMethodProcessor(String method,
MethodProcessor methodProcessor)
method - the name of the method whose processor we'd like to
unregister.methodProcessor - the MethodProcessor that we'd like to
unregister.public String getDefaultTransport()
public javax.sip.SipProvider getDefaultJainSipProvider()
public javax.sip.ListeningPoint getDefaultListeningPoint()
public String getOurDisplayName()
public javax.sip.header.UserAgentHeader getSipCommUserAgentHeader()
public void sayErrorSilently(javax.sip.ServerTransaction serverTransaction,
int errorCode)
serverTransaction - the transaction that we'd like to send an error
response in.errorCode - the code that the response should have.
public void sendAck(javax.sip.ClientTransaction clientTransaction)
throws javax.sip.SipException,
javax.sip.InvalidArgumentException
clientTransaction - the transaction that resulted in the ACK we are
about to send (MUST be an INVITE transaction).
javax.sip.InvalidArgumentException - if there is a problem with the supplied
CSeq ( for example <= 0 ).
javax.sip.SipException - if the CSeq does not relate to a previously sent
INVITE or if the Method that created the Dialog is not an INVITE ( for
example SUBSCRIBE) or if we fail to send the INVITE for whatever reason.
public void sayError(javax.sip.ServerTransaction serverTransaction,
int errorCode)
throws OperationFailedException
serverTransaction - the transaction that we'd like to send an error
response in.errorCode - the code that the response should have.
OperationFailedException - if we failed constructing or sending a
SIP Message.
public void sendInDialogRequest(javax.sip.SipProvider sipProvider,
javax.sip.message.Request request,
javax.sip.Dialog dialog)
throws OperationFailedException
sipProvider - the SipProvider to send the specified
request throughrequest - the Request to send through
sipProviderdialog - the Dialog as part of which the specified
request is to be sent
OperationFailedException - if creating a transaction or sending
the request fails.public List<String> getSupportedMethods()
public ProtocolIcon getProtocolIcon()
getProtocolIcon in interface ProtocolProviderServiceSipStatusEnum getSipStatusEnum()
SipRegistrarConnection getRegistrarConnection()
public javax.sip.address.Address parseAddressString(String uriStr)
throws ParseException
uriStr - a String containing the uri to parse.
ParseException - if uriStr is not properly formatted.
public InetSocketAddress resolveSipAddress(String address,
String transport)
throws UnknownHostException
address - the address we'd like to resolve.transport - the protocol that we'd like to use when accessing
address.
UnknownHostException - if address is not a valid host
address.
public InetSocketAddress resolveSipAddress(String address)
throws UnknownHostException
address - the address we'd like to resolve.
UnknownHostException - if address is not a valid host
address.
public InetSocketAddress getIntendedDestination(javax.sip.address.Address destination)
throws IllegalArgumentException
destination - the destination that we would contact.
IllegalArgumentException - if destination is not a valid
host/ip/fqdn
public InetSocketAddress getIntendedDestination(javax.sip.address.SipURI destination)
throws IllegalArgumentException
destination - the destination that we would contact.
IllegalArgumentException - if destination is not a valid
host/ip/fqdn
public InetSocketAddress getIntendedDestination(String host)
throws IllegalArgumentException
host - the destination that we would contact.
IllegalArgumentException - if destination is not a valid
host/ip/fqdn.public void registrationStateChanged(RegistrationStateChangeEvent event)
registrationStateChanged in interface RegistrationStateChangeListenerevent - the change event in the registration state of a provider.
public static void throwOperationFailedException(String message,
int errorCode,
Throwable cause,
Logger logger)
throws OperationFailedException
message - the message to be logged and then wrapped in a new
OperationFailedExceptionerrorCode - the error code to be assigned to the new
OperationFailedExceptioncause - the Throwable that has caused the necessity to log
an error and have a new OperationFailedException thrownlogger - the logger that we'd like to log the error message
and cause.
OperationFailedException - the exception that we wanted this method
to throw.
|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||