public class SipStackSharing extends java.lang.Object implements javax.sip.SipListener, NetworkConfigurationChangeListener
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONTACT_ADDRESS_CUSTOM_PARAM_NAME
We set a custom parameter in the contact address for registrar accounts,
so as to ease dispatching of incoming requests in case several accounts
have the same username in their contact address, eg:
sip:use[email protected]:5060;transport=udp;registering_acc=example_com
|
(package private) java.util.Map<java.lang.String,java.util.TimerTask> |
resetListeningPointsTimers
List of currently waiting timers that will monitor the protocol provider
|
Constructor and Description |
---|
SipStackSharing()
Constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
void |
addSipListener(ProtocolProviderServiceSipImpl listener)
Adds this listener as a candidate recipient for the dispatching
of new messages received from the JAIN-SIP SipProviders.
|
void |
configurationChanged(ChangeEvent event)
Listens for network changes and if we have a down interface
and we have a tcp/tls provider which is staying for 20 seconds in
unregistering state, it cannot unregister cause its using the old
address which is currently down, and we must recreate its listening
points so it can further reconnect.
|
javax.sip.SipProvider |
getJainSipProvider(java.lang.String transport)
Returns the JAIN-SIP SipProvider in charge of this
transport.
|
java.net.InetSocketAddress |
getLocalAddressForDestination(java.net.InetAddress dst,
int dstPort,
java.net.InetAddress localAddress,
java.lang.String transport)
Returns a local address to use with the specified TCP destination.
|
javax.sip.ListeningPoint |
getLP(java.lang.String transport)
Returns the JAIN-SIP ListeningPoint associated to the given
transport string.
|
static javax.sip.ServerTransaction |
getOrCreateServerTransaction(javax.sip.RequestEvent event)
Safely returns the transaction from the event if already exists.
|
void |
processDialogTerminated(javax.sip.DialogTerminatedEvent event)
Dispatches the event received from a JAIN-SIP SipProvider to one
of our "candidate recipient" listeners.
|
void |
processIOException(javax.sip.IOExceptionEvent event)
Dispatches the event received from a JAIN-SIP SipProvider to one
of our "candidate recipient" listeners.
|
void |
processRequest(javax.sip.RequestEvent event)
Dispatches the event received from a JAIN-SIP SipProvider to one
of our "candidate recipient" listeners.
|
void |
processResponse(javax.sip.ResponseEvent event)
Dispatches the event received from a JAIN-SIP SipProvider to one
of our "candidate recipient" listeners.
|
void |
processTimeout(javax.sip.TimeoutEvent event)
Dispatches the event received from a JAIN-SIP SipProvider to one
of our "candidate recipient" listeners.
|
void |
processTransactionTerminated(javax.sip.TransactionTerminatedEvent event)
Dispatches the event received from a JAIN-SIP SipProvider to one
of our "candidate recipient" listeners.
|
void |
removeSipListener(ProtocolProviderServiceSipImpl listener)
This listener will no longer be a candidate recipient for the
dispatching of new messages received from the JAIN-SIP
SipProviders.
|
public static final java.lang.String CONTACT_ADDRESS_CUSTOM_PARAM_NAME
java.util.Map<java.lang.String,java.util.TimerTask> resetListeningPointsTimers
SipStackSharing() throws OperationFailedException
OperationFailedException
- if creating the stack fails.public void addSipListener(ProtocolProviderServiceSipImpl listener) throws OperationFailedException
listener
- a new possible target for the dispatching process.OperationFailedException
- if creating one of the underlying
SipProviders fails for whatever reason.public void removeSipListener(ProtocolProviderServiceSipImpl listener)
listener
- possible target to remove for the dispatching process.public javax.sip.ListeningPoint getLP(java.lang.String transport)
transport
- a string like "UDP", "TCP" or "TLS".public javax.sip.SipProvider getJainSipProvider(java.lang.String transport)
transport
- a String like "TCP", "UDP" or "TLS"public void processDialogTerminated(javax.sip.DialogTerminatedEvent event)
processDialogTerminated
in interface javax.sip.SipListener
event
- the event received for a
SipProvider.public void processIOException(javax.sip.IOExceptionEvent event)
processIOException
in interface javax.sip.SipListener
event
- the event received for a SipProvider.public void processRequest(javax.sip.RequestEvent event)
processRequest
in interface javax.sip.SipListener
event
- the event received for a SipProvider.public void processResponse(javax.sip.ResponseEvent event)
processResponse
in interface javax.sip.SipListener
event
- the event received for a SipProvider.public void processTimeout(javax.sip.TimeoutEvent event)
processTimeout
in interface javax.sip.SipListener
event
- the event received for a SipProvider.public void processTransactionTerminated(javax.sip.TransactionTerminatedEvent event)
processTransactionTerminated
in interface javax.sip.SipListener
event
- the event received for a
SipProvider.public static javax.sip.ServerTransaction getOrCreateServerTransaction(javax.sip.RequestEvent event) throws javax.sip.TransactionAlreadyExistsException, javax.sip.TransactionUnavailableException
event
- the request eventjavax.sip.TransactionAlreadyExistsException
- if transaction existsjavax.sip.TransactionUnavailableException
- if unavailablepublic java.net.InetSocketAddress getLocalAddressForDestination(java.net.InetAddress dst, int dstPort, java.net.InetAddress localAddress, java.lang.String transport) throws java.io.IOException
dst
- the destination address that the socket would need to connect
to.dstPort
- the port number that the connection would be established
with.localAddress
- the address that we would like to bind on
(null for the "any" address).transport
- the transport that will be used TCP ot TLSjava.io.IOException
- if we fail binding the local socketpublic void configurationChanged(ChangeEvent event)
configurationChanged
in interface NetworkConfigurationChangeListener
event
- the change event.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.