public class EventPackageSupport extends MethodProcessorAdapter
Modifier and Type | Class and Description |
---|---|
protected static class |
EventPackageSupport.Subscription
Represents a general event package subscription in the sense of RFC 3265
"Session Initiation Protocol (SIP)-Specific Event Notification" and its
signaling characteristics such as Request URI, id tag value of its Event
header.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
contentSubType
The sub-type of the content type of the response bodies announced,
expected and supported by the subscriptions/notifications managed by this
instance.
|
protected java.lang.String |
eventPackage
The name of the event package this instance implements and carried in the
Event and Allow-Events headers.
|
protected ProtocolProviderServiceSipImpl |
protocolProvider
The SIP
ProtocolProviderService implementation for which
this instance provides support for a specific event package. |
protected int |
subscriptionDuration
The duration of each subscription managed by this instance and carried in
the Expires header.
|
protected TimerScheduler |
timer
The
Timer support which executes the time-based tasks of
this instance. |
Modifier | Constructor and Description |
---|---|
protected |
EventPackageSupport(ProtocolProviderServiceSipImpl protocolProvider,
java.lang.String eventPackage,
int subscriptionDuration,
java.lang.String contentSubType,
TimerScheduler timer)
Initializes a new
EventPackageSupport instance which is to
provide support according to RFC 3265 to a specific SIP
ProtocolProviderService implementation for a specific event
package. |
Modifier and Type | Method and Description |
---|---|
protected void |
addSubscription(java.lang.String callId,
EventPackageSupport.Subscription subscription)
Adds a specific Subscription associated with a specific CallId
to the list of subscriptions managed by this instance.
|
java.lang.String |
getEventPackage()
Gets the name of the event package this instance implements and carried
in the Event and Allow-Events headers.
|
(package private) static javax.sip.ServerTransaction |
getOrCreateServerTransaction(javax.sip.RequestEvent requestEvent)
Safely returns the
ServerTransaction associated with a
specific RequestEvent or creates a new one if the specified
RequestEvent is not associated with one. |
protected EventPackageSupport.Subscription |
getSubscription(javax.sip.address.Address toAddress,
java.lang.String eventId)
Gets the Subscription from the list of subscriptions managed by
this instance which is associated with a specific subscription
Address/Request URI and has a specific id tag in its Event
header.
|
protected EventPackageSupport.Subscription |
getSubscription(java.lang.String callId)
Gets the Subscription from the list of subscriptions managed by
this instance which is associated with a specific CallId.
|
protected EventPackageSupport.Subscription[] |
getSubscriptions()
Gets a new copy of the list of Subscriptions managed by this
instance.
|
protected void |
processAuthenticationChallenge(javax.sip.ClientTransaction clientTransaction,
javax.sip.message.Response response,
javax.sip.SipProvider jainSipProvider)
Attempts to re-generate a
Request within a specific
ClientTransaction with the proper authorization headers. |
(package private) static void |
processAuthenticationChallenge(ProtocolProviderServiceSipImpl protocolProvider,
javax.sip.ClientTransaction clientTransaction,
javax.sip.message.Response response,
javax.sip.SipProvider jainSipProvider)
Attempts to re-generate a
Request within a specific
ClientTransaction with the proper authorization headers. |
void |
removeSubscription(javax.sip.address.Address toAddress)
Removes a Subscription from the list of subscriptions managed by
this instance which is associated with a specific subscription
Address/Request URI and has an id tag in its Event header of
null.
|
boolean |
removeSubscription(javax.sip.address.Address toAddress,
java.lang.String eventId)
Removes a Subscription from the list of subscriptions managed by
this instance which is associated with a specific subscription
Address/Request URI and has a specific id tag in its Event
header.
|
protected boolean |
removeSubscription(java.lang.String callId,
EventPackageSupport.Subscription subscription)
Removes a specific Subscription from the list of subscriptions
managed by this instance if it is associated with a specific CallId.
|
static boolean |
sendNotImplementedResponse(ProtocolProviderServiceSipImpl provider,
javax.sip.RequestEvent requestEvent)
Sends a
Response.NOT_IMPLEMENTED Response to a specific
Request . |
processDialogTerminated, processIOException, processRequest, processResponse, processTimeout, processTransactionTerminated
protected final java.lang.String contentSubType
protected final java.lang.String eventPackage
protected final ProtocolProviderServiceSipImpl protocolProvider
ProtocolProviderService
implementation for which
this instance provides support for a specific event package.protected final int subscriptionDuration
protected final TimerScheduler timer
Timer
support which executes the time-based tasks of
this instance.protected EventPackageSupport(ProtocolProviderServiceSipImpl protocolProvider, java.lang.String eventPackage, int subscriptionDuration, java.lang.String contentSubType, TimerScheduler timer)
EventPackageSupport
instance which is to
provide support according to RFC 3265 to a specific SIP
ProtocolProviderService
implementation for a specific event
package.protocolProvider
- the SIP ProtocolProviderService
implementation
for which the new instance is to provide support for a
specific event packageeventPackage
- the name of the event package the new instance is to implement
and carry in the Event and Allow-Events headerssubscriptionDuration
- the duration of each subscription to be managed by the new
instance and to be carried in the Expires headers. Subscribers
will interpret it as the value to be announced in the SIP
signaling related to SUBSCRIBE requests originating from them,
notifiers will use it as the default value for SUBSCRIBE
requests coming to them which do not specify an explicit value
in the Expires headers.contentSubType
- the sub-type of the content type of the response bodies to be
announced, expected and supported by the
subscriptions/notifications to be managed by the new instancetimer
- the Timer
support which is to execute the
time-based tasks of the new instanceprotected void addSubscription(java.lang.String callId, EventPackageSupport.Subscription subscription)
callId
- the CallId associated with the Subscription to be
addedsubscription
- the Subscription to be added to the list of
subscriptions managed by this instancepublic final java.lang.String getEventPackage()
static javax.sip.ServerTransaction getOrCreateServerTransaction(javax.sip.RequestEvent requestEvent)
ServerTransaction
associated with a
specific RequestEvent
or creates a new one if the specified
RequestEvent
is not associated with one. Does not throw
TransactionAlreadyExistsException
and
TransactionUnavailableException
but rather logs these
exceptions if they occur and returns null.requestEvent
- the RequestEvent
to get the associated
ServerTransaction
ofServerTransaction
carried by the specified
RequestEvent
if the carried value in question is not
null; a new ServerTransaction
initializes
with the Request
carried by the specified
RequestEvent
if the event in question carries a
null ServerTransaction
; null in
case of an exceptionprotected EventPackageSupport.Subscription getSubscription(javax.sip.address.Address toAddress, java.lang.String eventId)
toAddress
- the subscription Address/Request URI of the
Subscription to be retrievedeventId
- the id tag placed in the Event header of the
Subscription to be retrieved if there is one or null if
the Subscription should have no id tag in its Event headerprotected EventPackageSupport.Subscription getSubscription(java.lang.String callId)
callId
- the CallId associated with the Subscription to be
retrievedprotected EventPackageSupport.Subscription[] getSubscriptions()
protected void processAuthenticationChallenge(javax.sip.ClientTransaction clientTransaction, javax.sip.message.Response response, javax.sip.SipProvider jainSipProvider) throws OperationFailedException
Request
within a specific
ClientTransaction
with the proper authorization headers.clientTransaction
- the ClientTransaction
which was challenged to
authenticateresponse
- the challenging Response
jainSipProvider
- the provider which received the authentication challengeOperationFailedException
- if processing the authentication challenge failedstatic void processAuthenticationChallenge(ProtocolProviderServiceSipImpl protocolProvider, javax.sip.ClientTransaction clientTransaction, javax.sip.message.Response response, javax.sip.SipProvider jainSipProvider) throws OperationFailedException
Request
within a specific
ClientTransaction
with the proper authorization headers.protocolProvider
- the SIP ProtocolProviderService
implementation
which received the authentication challenge and which is to
re-generate and send the respective Request
clientTransaction
- the ClientTransaction
which was challenged to
authenticateresponse
- the challenging Response
jainSipProvider
- the provider which received the authentication challengeOperationFailedException
- if processing the authentication challenge failedpublic void removeSubscription(javax.sip.address.Address toAddress)
toAddress
- the subscription Address/Request URI of the
Subscription to be removedpublic boolean removeSubscription(javax.sip.address.Address toAddress, java.lang.String eventId)
toAddress
- the subscription Address/Request URI of the
Subscription to be removedeventId
- the id tag in the Event header of the
Subscription to be removed; null if the
Subscription should have no id tag in its Event headerprotected boolean removeSubscription(java.lang.String callId, EventPackageSupport.Subscription subscription)
callId
- the CallId which is expected to be associated with the
specified Subscriptionsubscription
- the Subscription to be removed from the list
of subscriptions managed by this instance if it is associated with the
specified CallIdpublic static boolean sendNotImplementedResponse(ProtocolProviderServiceSipImpl provider, javax.sip.RequestEvent requestEvent)
Response.NOT_IMPLEMENTED
Response to a specific
Request
.provider
- the ProtocolProviderServiceSipImpl
through which
the Response is to be sentrequestEvent
- the Request to which the Response
to be sent is to respond
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.