public abstract class EventPackageNotifier extends EventPackageSupport
Modifier and Type | Class and Description |
---|---|
static class |
EventPackageNotifier.Subscription
Represents a general event package subscription in the sense of RFC 3265
"Session Initiation Protocol (SIP)-Specific Event Notification" from the
point of view of the notifier and its signaling characteristics such as
Request URI, id tag value of its Event header, the Dialog
which has been created by the associated SUBSCRIBE request or through
which NOTIFY requests are to be sent.
|
static interface |
EventPackageNotifier.SubscriptionFilter
Represents a filter for Subscriptions i.e.
|
contentSubType, eventPackage, protocolProvider, subscriptionDuration, timer
Constructor and Description |
---|
EventPackageNotifier(ProtocolProviderServiceSipImpl protocolProvider,
java.lang.String eventPackage,
int subscriptionDuration,
java.lang.String contentSubType,
TimerScheduler timer)
Initializes a new EventPackageNotifier instance which is to
provide notifier support according to RFC 3265 to a specific SIP
ProtocolProviderService implementation for a specific event
package.
|
Modifier and Type | Method and Description |
---|---|
protected javax.sip.ClientTransaction |
createNotify(javax.sip.Dialog dialog,
byte[] content,
java.lang.String subscriptionState,
java.lang.String reason)
Creates a NOTIFY request which is to notify about a specific subscription
state and carry a specific content.
|
protected abstract EventPackageNotifier.Subscription |
createSubscription(javax.sip.address.Address fromAddress,
java.lang.String eventId)
Creates a new Subscription instance which is to represent the
subscription signaling from and to a specific target identified by its
Address/Request URI and a specific EventId tag.
|
protected EventPackageNotifier.Subscription |
getSubscription(javax.sip.address.Address fromAddress,
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 EventPackageNotifier.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.
|
void |
notify(EventPackageNotifier.Subscription subscription,
java.lang.String subscriptionState,
java.lang.String reason)
Notifies a specific target identified by its Subscription about
a specific subscription state and a specific reason for that subscription
state via a NOTIFY request.
|
void |
notifyAll(java.lang.String subscriptionState,
java.lang.String reason)
Notifies all targets represented by the Subscriptions managed by
this instance about a specific subscription state and a specific reason
for that subscription state via NOTIFY requests.
|
void |
notifyAll(java.lang.String subscriptionState,
java.lang.String reason,
EventPackageNotifier.SubscriptionFilter filter)
Notifies all targets represented by the Subscriptions managed by
this instance which are accepted by a specific
SubscriptionFilter about a specific subscription state and a
specific reason for that subscription state via NOTIFY requests.
|
boolean |
processRequest(javax.sip.RequestEvent requestEvent)
Processes incoming subscribe requests.
|
boolean |
processResponse(javax.sip.ResponseEvent responseEvent)
Handles an incoming response to a request we'vre previously sent.
|
protected void |
removeSubscription(javax.sip.message.Response response,
java.lang.String eventId,
javax.sip.ClientTransaction clientTransaction)
Removes a Subscription from the list of subscriptions managed by
this instance identified by the Response to our NOTIFY request.
|
addSubscription, getEventPackage, getOrCreateServerTransaction, getSubscriptions, processAuthenticationChallenge, processAuthenticationChallenge, removeSubscription, removeSubscription, removeSubscription, sendNotImplementedResponse
processDialogTerminated, processIOException, processTimeout, processTransactionTerminated
public EventPackageNotifier(ProtocolProviderServiceSipImpl protocolProvider, java.lang.String eventPackage, int subscriptionDuration, java.lang.String contentSubType, TimerScheduler timer)
protocolProvider
- the SIP ProtocolProviderService
implementation for which the new instance is to provide notifier 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 headerscontentSubType
- the sub-type of the content type of the NOTIFY
bodies to be announced, expected and supported by the subscriptions to be
managed by the new instancetimer
- the Timer support which is to time out the
subscriptions to be managed by the new instanceprotected javax.sip.ClientTransaction createNotify(javax.sip.Dialog dialog, byte[] content, java.lang.String subscriptionState, java.lang.String reason) throws OperationFailedException
dialog
- the Dialog to create the NOTIFY request incontent
- the content to be carried by the NOTIFY request to be
createdsubscriptionState
- the subscription statereason
- the reason for the specified subscription state;
null for no reasonOperationFailedException
- if something goes wrong during the
creation of the requestprotected abstract EventPackageNotifier.Subscription createSubscription(javax.sip.address.Address fromAddress, java.lang.String eventId)
fromAddress
- the Address/Request URI of the subscription
targeteventId
- the EventId tag of the subscription signaling associated
with the specified targetprotected EventPackageNotifier.Subscription getSubscription(javax.sip.address.Address fromAddress, java.lang.String eventId)
getSubscription
in class EventPackageSupport
fromAddress
- 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 EventPackageNotifier.Subscription getSubscription(java.lang.String callId)
getSubscription
in class EventPackageSupport
callId
- the CallId associated with the Subscription to be
retrievedpublic void notify(EventPackageNotifier.Subscription subscription, java.lang.String subscriptionState, java.lang.String reason) throws OperationFailedException
subscription
- the target identified by its Subscription to
be notified about the specified subscription state and the specified
reason for that subscription state via a NOTIFY requestsubscriptionState
- the subscription state to notify the target
represented by its Subscription aboutreason
- the reason for that subscription stateOperationFailedException
- if sending the NOTIFY request failedpublic void notifyAll(java.lang.String subscriptionState, java.lang.String reason) throws OperationFailedException
subscriptionState
- the subscription state to be sent to all targets
represented by the Subscriptions managed by this instance via
NOTIFY requestsreason
- the reason for the specified subscription stateOperationFailedException
- if anything goes wrong while sending out
the notifications.public void notifyAll(java.lang.String subscriptionState, java.lang.String reason, EventPackageNotifier.SubscriptionFilter filter) throws OperationFailedException
subscriptionState
- the subscription state to be sent to all targets
represented by the Subscriptions managed by this instance which
are accepted by filter via NOTIFY requestsreason
- the reason for the specified subscription statefilter
- the SubscriptionFilter to pick up the
Subscriptions managed by this instance to be notified about
subscriptionStateOperationFailedException
- if anything goes wrong while sending out
the notificationspublic boolean processRequest(javax.sip.RequestEvent requestEvent)
processRequest
in interface MethodProcessor
processRequest
in class MethodProcessorAdapter
requestEvent
- the event containing the request we need to handleMethodProcessor.processRequest(RequestEvent)
public boolean processResponse(javax.sip.ResponseEvent responseEvent)
processResponse
in interface MethodProcessor
processResponse
in class MethodProcessorAdapter
responseEvent
- the event we need to handleMethodProcessor.processResponse(ResponseEvent)
protected void removeSubscription(javax.sip.message.Response response, java.lang.String eventId, javax.sip.ClientTransaction clientTransaction)
response
- a Response identifying the Subscription
to be removed from the list of subscriptions managed by this instanceeventId
- the value of the id tagclientTransaction
- the ClientTransaction through which the
specified Response came
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.