|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.cafesip.sipunit.PresenceNotifySender
org.cafesip.sipunit.ReferNotifySender
public class ReferNotifySender
The primary purpose of this class is as a test utility, to verify other UA's NOTIFY reception processing. When instantiated, an object of this class listens for a REFER or SUBSCRIBE message. After the calling program has sent a message to this object's uri, it can call this object's processRefer() or processSubscribe() method to receive and process the received request and send a response. After that, this object sends a NOTIFY message on that subscription each time method sendNotify() is called, with the given content body. This class can listen for and show the response to a given sent NOTIFY message. It can receive and process multiple request messages for a subscription.
| Constructor Summary | |
|---|---|
ReferNotifySender(SipPhone userb)
A constructor for this class. |
|
| Method Summary | |
|---|---|
boolean |
processRefer()
This method waits for up to 10 seconds to receive a REFER and if received, it sends an OK response. |
boolean |
processRefer(long timeout,
int statusCode,
java.lang.String reasonPhrase)
This method starts a thread that waits for up to 'timeout' milliseconds to receive a REFER and if received, it sends a response with 'statusCode' and 'reasonPhrase' (if not null). |
boolean |
processRefer(long timeout,
int statusCode,
java.lang.String reasonPhrase,
int duration,
javax.sip.header.EventHeader overrideEvent)
Same as the other processRefer() except allows for a couple of overrides for testing error handling by the far end outbound REFER side: (a) takes a duration for adding ExpiresHeader to the REFER response (the response shouldn't have an expires header), and (b) this method takes an EventHeader for overriding what would normally/correctly be sent back in the response (normally same as what was received in the request). |
boolean |
processReferSendNotifyBeforeResponse(long timeout,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String notifySubscriptionState,
java.lang.String notifyTermReason,
java.lang.String notifyBody,
int notifyTimeLeft)
This method starts a thread that waits for up to 'timeout' milliseconds to receive a REFER and if received, it sends NOTIFY with the given notify parms and 500ms later, it sends a response with 'statusCode' and 'reasonPhrase' (if not null). |
boolean |
sendNotify(java.lang.String subscriptionState,
java.lang.String termReason,
java.lang.String body,
int timeLeft,
boolean viaProxy)
This method creates a NOTIFY message using the given parameters and sends it to the subscriber. |
boolean |
sendNotify(java.lang.String subscriptionState,
java.lang.String termReason,
java.lang.String body,
int timeLeft,
javax.sip.header.EventHeader eventHdr,
javax.sip.header.SubscriptionStateHeader ssHdr,
javax.sip.header.AcceptHeader accHdr,
javax.sip.header.ContentTypeHeader ctHdr,
boolean viaProxy)
This method creates a NOTIFY message using the given parameters and sends it to the subscriber. |
| Methods inherited from class org.cafesip.sipunit.PresenceNotifySender |
|---|
addNotifyHeaders, dispose, getAllReceivedRequests, getAllReceivedResponses, getDialog, getErrorMessage, getLastReceivedRequest, getLastReceivedResponse, getLastSentNotify, needAuthorization, processEvent, processSubscribe, processSubscribe, processSubscribe, register, resendWithAuthorization, sendNotify, sendStatefulNotify, setDialog, waitResponse |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReferNotifySender(SipPhone userb)
userb - SipPhone object to use for messaging.
java.lang.Exception - If there's a problem| Method Detail |
|---|
public boolean processRefer()
public boolean processRefer(long timeout,
int statusCode,
java.lang.String reasonPhrase)
timeout - - number of milliseconds to wait for the requeststatusCode - - use in the response to the requestreasonPhrase - - if not null, use in the response
public boolean processRefer(long timeout,
int statusCode,
java.lang.String reasonPhrase,
int duration,
javax.sip.header.EventHeader overrideEvent)
public boolean processReferSendNotifyBeforeResponse(long timeout,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String notifySubscriptionState,
java.lang.String notifyTermReason,
java.lang.String notifyBody,
int notifyTimeLeft)
timeout - - number of milliseconds to wait for the requeststatusCode - - use in the response to the requestreasonPhrase - - if not null, use in the responsenotifySubscriptionState - notifyTermReason - notifyBody - notifyTimeLeft -
public boolean sendNotify(java.lang.String subscriptionState,
java.lang.String termReason,
java.lang.String body,
int timeLeft,
boolean viaProxy)
sendNotify in class PresenceNotifySendersubscriptionState - - String to use as the subscription state.termReason - - used only when subscriptionState = TERMINATED.body - - NOTIFY body to put in the messagetimeLeft - - expiry in seconds to put in the NOTIFY message (used only
when subscriptionState = ACTIVE or PENDING).viaProxy - If true, send the message to the proxy. In this case a Route
header will be added. Else send the message as is.
public boolean sendNotify(java.lang.String subscriptionState,
java.lang.String termReason,
java.lang.String body,
int timeLeft,
javax.sip.header.EventHeader eventHdr,
javax.sip.header.SubscriptionStateHeader ssHdr,
javax.sip.header.AcceptHeader accHdr,
javax.sip.header.ContentTypeHeader ctHdr,
boolean viaProxy)
sendNotify in class PresenceNotifySendersubscriptionState - - String to use as the subscription state. Overridden by
sshdr.termReason - - used only when subscriptionState = TERMINATED. Overridden by
sshdr.body - - NOTIFY body to put in the messagetimeLeft - - expiry in seconds to put in the NOTIFY message (used only
when subscriptionState = ACTIVE or PENDING). Overridden by
sshdr.eventHdr - - if not null, use this event header in the NOTIFY messagessHdr - - if not null, use this subscription state header in the
NOTIFY message instead of building one from other parameters
given.accHdr - - if not null, use this accept header. Otherwise build the
default package one.ctHdr - - if not null, use this content type header. Otherwise build
the default package one.viaProxy - If true, send the message to the proxy. In this case a Route
header will be added. Else send the message as is.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||