public class SipRegistrarConnection extends MethodProcessorAdapter
Modifier and Type | Field and Description |
---|---|
(package private) javax.sip.ClientTransaction |
regTrans
The client transaction that we used for sending the last REGISTER
request.
|
Modifier | Constructor and Description |
---|---|
protected |
SipRegistrarConnection()
Empty constructor that we only have in order to allow for classes like
SipRegistrarlessConnection to extend this class.
|
|
SipRegistrarConnection(java.lang.String registrarName,
int registrarPort,
java.lang.String registrationTransport,
ProtocolProviderServiceSipImpl sipProviderCallback)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
javax.sip.address.Address |
getAddressOfRecord()
Returns the address of record that we are using to register against our
registrar or null if this is a fake or "Registrarless" connection.
|
javax.sip.SipProvider |
getJainSipProvider()
Returns the JAIN SIP provider that should be used for communication with
our current registrar.
|
javax.sip.address.SipURI |
getRegistrarURI()
The registrar URI we use for registrar connection.
|
RegistrationState |
getRegistrationState()
Returns the state of this connection.
|
java.lang.String |
getTransport()
Returns the transport that this connection is currently using to
communicate with the Registrar.
|
boolean |
isRegistrarless()
Returns true if this is a fake connection that is not actually using
a registrar.
|
boolean |
isRequestFromSameConnection(javax.sip.message.Request request)
Checks a particular request is it coming from the same proxy we are
currently using.
|
boolean |
isRouteHeaderEnabled()
Determines whether Register requests should be using a route header.
|
boolean |
processIOException(javax.sip.IOExceptionEvent exceptionEvent)
Process an asynchronously reported IO Exception.
|
void |
processNotImplemented(javax.sip.ClientTransaction transatcion,
javax.sip.message.Response response)
Handles a NOT_IMPLEMENTED response sent in reply of our register request.
|
void |
processOK(javax.sip.ClientTransaction clientTransatcion,
javax.sip.message.Response response)
An ok here means that our registration has been accepted or terminated
(depending on the corresponding REGISTER request).
|
boolean |
processRequest(javax.sip.RequestEvent requestEvent)
Processes a Request received on a SipProvider upon which this SipListener
is registered.
|
boolean |
processResponse(javax.sip.ResponseEvent responseEvent)
Analyzes the incoming responseEvent and then forwards it to the
proper event handler.
|
boolean |
processTimeout(javax.sip.TimeoutEvent timeoutEvent)
Processes a retransmit or expiration Timeout of an underlying
Transaction handled by this SipListener. |
(package private) void |
register()
Sends the REGISTER request to the server specified in the constructor.
|
void |
setRegistrationState(RegistrationState newState,
int reasonCode,
java.lang.String reason)
Sets our registration state to newState and dispatches an event
through the protocol provider service impl.
|
void |
setRegistrationState(RegistrationState newState,
int reasonCode,
java.lang.String reason,
boolean userRequest)
Sets our registration state to newState and dispatches an event
through the protocol provider service impl.
|
(package private) void |
setTransport(java.lang.String newRegistrationTransport)
Changes transport of registrar connection and recreates
registrar URI.
|
java.lang.String |
toString()
Returns a string representation of this connection instance
instance including information that would permit to distinguish it among
other sip listeners when reading a log file.
|
void |
unregister()
Sends a unregistered request to the registrar thus ending our
registration.
|
void |
unregister(boolean userRequest)
Sends a unregistered request to the registrar thus ending our
registration.
|
processDialogTerminated, processTransactionTerminated
javax.sip.ClientTransaction regTrans
public SipRegistrarConnection(java.lang.String registrarName, int registrarPort, java.lang.String registrationTransport, ProtocolProviderServiceSipImpl sipProviderCallback)
registrarName
- the FQDN of the registrar we will
be registering with.registrarPort
- the port of the registrar we will
be registering with.registrationTransport
- the transport to use when sending our
REGISTER request to the server.sipProviderCallback
- a reference to the
ProtocolProviderServiceSipImpl instance that created us.protected SipRegistrarConnection()
void setTransport(java.lang.String newRegistrationTransport)
newRegistrationTransport
- the new transport.void register() throws OperationFailedException
OperationFailedException
- with the corresponding error code
if registration or construction of the Register request fail.public void processOK(javax.sip.ClientTransaction clientTransatcion, javax.sip.message.Response response)
clientTransatcion
- the ClientTransaction that we created when
sending the register request.response
- the OK Response that we've just received.public boolean isRequestFromSameConnection(javax.sip.message.Request request)
request
- the request to check.public void unregister() throws OperationFailedException
OperationFailedException
- with the corresponding code if sending
or constructing the request fails.public void unregister(boolean userRequest) throws OperationFailedException
OperationFailedException
- with the corresponding code if sending
or constructing the request fails.public RegistrationState getRegistrationState()
public void setRegistrationState(RegistrationState newState, int reasonCode, java.lang.String reason)
newState
- a reference to the RegistrationState that we're currently
detaining.reasonCode
- one of the REASON_XXX error codes specified in
RegistrationStateChangeEvent
.reason
- a reason String further explaining the reasonCode.public void setRegistrationState(RegistrationState newState, int reasonCode, java.lang.String reason, boolean userRequest)
newState
- a reference to the RegistrationState that we're currently
detaining.reasonCode
- one of the REASON_XXX error codes specified in
RegistrationStateChangeEvent
.reason
- a reason String further explaining the reasonCode.public void processNotImplemented(javax.sip.ClientTransaction transatcion, javax.sip.message.Response response)
transatcion
- the transaction that our initial register request
belongs to.response
- our initial register request.public javax.sip.SipProvider getJainSipProvider()
public java.lang.String getTransport()
public boolean processResponse(javax.sip.ResponseEvent responseEvent)
processResponse
in interface MethodProcessor
processResponse
in class MethodProcessorAdapter
responseEvent
- the responseEvent that we received
ProtocolProviderService.public boolean processRequest(javax.sip.RequestEvent requestEvent)
processRequest
in interface MethodProcessor
processRequest
in class MethodProcessorAdapter
requestEvent
- requestEvent fired from the SipProvider to the
SipListener representing a Request received from the network.public boolean processTimeout(javax.sip.TimeoutEvent timeoutEvent)
Transaction
handled by this SipListener.processTimeout
in interface MethodProcessor
processTimeout
in class MethodProcessorAdapter
timeoutEvent
- the timeoutEvent received indicating either the
message retransmit or transaction timed out.public boolean processIOException(javax.sip.IOExceptionEvent exceptionEvent)
processIOException
in interface MethodProcessor
processIOException
in class MethodProcessorAdapter
exceptionEvent
- The Exception event that is reported to the
application.public java.lang.String toString()
toString
in class java.lang.Object
public boolean isRouteHeaderEnabled()
public boolean isRegistrarless()
public javax.sip.address.SipURI getRegistrarURI() throws java.text.ParseException
java.text.ParseException
public javax.sip.address.Address getAddressOfRecord()
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.