public class SipProviderImpl extends Object implements SipProvider, SipProviderExt, SIPTransactionEventListener, SIPDialogEventListener
Modifier and Type | Field and Description |
---|---|
protected EventScanner |
eventScanner |
protected SipStackImpl |
sipStack |
Modifier | Constructor and Description |
---|---|
protected |
SipProviderImpl(SipStackImpl sipStack)
Creates a new instance of SipProviderImpl
|
Modifier and Type | Method and Description |
---|---|
void |
addListeningPoint(ListeningPoint listeningPoint)
This method adds the supplied ListeningPoint to the list of
ListeningPoints associated to this SipProvider.
|
void |
addSipListener(SipListener sipListener)
This method registers the SipListener object to this SipProvider, once
registered the SIP Listener recieve events emitted from the SipProvider.
|
protected Object |
clone() |
protected SIPClientTransaction |
createClientTransaction(Request request,
Hop hop) |
void |
dialogErrorEvent(SIPDialogErrorEvent dialogErrorEvent)
Invoked when an error has ocurred with a dialog.
|
ListeningPoint |
getListeningPoint()
Returns the ListeningPoint of this SipProvider.
|
ListeningPoint |
getListeningPoint(String transport)
Get the listening point for a given transport.
|
ListeningPoint[] |
getListeningPoints()
Returns all the ListeningPoints of this SipProvider.
|
CallIdHeader |
getNewCallId()
Returns a unique CallIdHeader for identifying dialogues between two
SIP applications.
|
ClientTransaction |
getNewClientTransaction(Request request)
Before an application can send a new request it must first request
a new client transaction to handle that Request.
|
Dialog |
getNewDialog(Transaction transaction)
Create a dialog for the given transaction.
|
ServerTransaction |
getNewServerTransaction(Request request)
An application has the responsibility of deciding to respond to a
Request that does not match an existing server transaction.
|
SipListener |
getSipListener() |
SipStack |
getSipStack()
Returns the SipStack that created this SipProvider.
|
void |
handleEvent(EventObject sipEvent,
SIPTransaction transaction)
Handle the SIP event - because we have only one listener and we are
already in the context of a separate thread, we dont need to enque the
event and signal another thread.
|
boolean |
isAutomaticDialogSupportEnabled() |
boolean |
isDialogErrorsAutomaticallyHandled() |
void |
removeListeningPoint(ListeningPoint listeningPoint)
Removes the specified ListeningPoint from this SipProvider.
|
void |
removeListeningPoints()
Remove all the listening points for this sip provider.
|
void |
removeSipListener(SipListener sipListener)
Removes the specified SipListener from this SipProvider.
|
void |
sendRequest(Request request)
Sends the Request statelessly, that is no transaction record is
associated with this action.
|
void |
sendResponse(Response response)
Sends the Response statelessly, that is no transaction record is
associated with this action.
|
void |
setAutomaticDialogSupportEnabled(boolean automaticDialogSupportEnabled)
Enable or disable automatic dialog creation for this Provider.
|
void |
setDialogErrorsAutomaticallyHandled()
Sets a flag that indicates that automatic error handling is enabled for this dialog (the
default when automatic dialog support is enabled).
|
void |
setListeningPoint(ListeningPoint listeningPoint)
This method sets the ListeningPoint of the SipProvider.
|
protected void |
stop()
Stop processing messages for this provider.
|
void |
transactionErrorEvent(SIPTransactionErrorEvent transactionErrorEvent)
Invoked when an error has ocurred with a transaction.
|
protected SipStackImpl sipStack
protected EventScanner eventScanner
protected SipProviderImpl(SipStackImpl sipStack)
protected void stop()
public ListeningPoint getListeningPoint(String transport)
SipProvider
getListeningPoint
in interface SipProvider
transport
- -- the transport for the listening pointpublic void handleEvent(EventObject sipEvent, SIPTransaction transaction)
sipEvent
- is the event to process.protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void addSipListener(SipListener sipListener) throws TooManyListenersException
SipProvider
addSipListener
in interface SipProvider
sipListener
- the SipListener to be registered with the SipProvider.TooManyListenersException
- when a new SipListener attempts to
register with the SipProvider when another SipListener is already
registered with this SipProvider.public ListeningPoint getListeningPoint()
SipProvider
getListeningPoint
in interface SipProvider
public CallIdHeader getNewCallId()
SipProvider
getNewCallId
in interface SipProvider
protected SIPClientTransaction createClientTransaction(Request request, Hop hop) throws TransactionUnavailableException
request
- hop
- TransactionUnavailableException
public ClientTransaction getNewClientTransaction(Request request) throws TransactionUnavailableException
SipProvider
getNewClientTransaction
in interface SipProvider
request
- the new Request message that is to handled statefully by
the ClientTransaction.TransactionUnavailableException
- if a new transaction can not be created, for example
the next hop of the request can not be determined or the method is "ACK"ClientTransaction
public ServerTransaction getNewServerTransaction(Request request) throws TransactionAlreadyExistsException, TransactionUnavailableException
SipProvider
getNewServerTransaction
in interface SipProvider
request
- the Request message that the doesn't match an existing
transaction that the application decides to handle statefully.TransactionAlreadyExistsException
- if a transaction already exists
that is already handling this Request. This may happen if the application
gets retransmits of the same request before the initial transaction is
allocated.TransactionUnavailableException
- if a new transaction can not be created, for example
the next hop of the request can not be determined or the method is "ACK"ServerTransaction
public SipStack getSipStack()
SipProvider
getSipStack
in interface SipProvider
SipStack
public void removeSipListener(SipListener sipListener)
SipProvider
removeSipListener
in interface SipProvider
sipListener
- the SipListener to be removed from this SipProvider.public void sendRequest(Request request) throws SipException
SipProvider
Once the Request message has been passed to this method, the SipProvider will forget about this Request. No transaction semantics will be associated with the Request and the SipProvider will not handle retranmissions for the Request. If these semantics are required it is the responsibility of the application not the SipProvider.
sendRequest
in interface SipProvider
request
- the Request message to send statelesslySipException
- if the SipProvider cannot send the Request for any
reason.Request
public void sendResponse(Response response) throws SipException
SipProvider
sendResponse
in interface SipProvider
response
- the Response to send statelessly.SipException
- if the SipProvider cannot send the Response for any
reason.Response
,
Response
public void setListeningPoint(ListeningPoint listeningPoint)
SipProvider
setListeningPoint
in interface SipProvider
public Dialog getNewDialog(Transaction transaction) throws SipException
SipProvider
For UAC's Forked calls are handled as follows: The response of a forked call that completes the initially created dialog will use the original dialog that is associated with the transaction. Subsequent responses that correspond to other branches of the fork ( ie. with the same From header tag, and Call ID but different To header tags) result in the creation of additional dialogs that are associated with these responses. The created dialog is made available to the UAC ( Listener ) via the method ResponseEvent.getDialog
Transactions that belong to the Dialog are automatically associated with the Dialog by the stack and can be retrieved with Transaction.getDialog().
getNewDialog
in interface SipProvider
transaction
- - transaction that is used to extract the relevant
information to create the dialog.SipException
- if one or more of the following is true: public void transactionErrorEvent(SIPTransactionErrorEvent transactionErrorEvent)
transactionErrorEvent
in interface SIPTransactionEventListener
transactionErrorEvent
- Error event.public void dialogErrorEvent(SIPDialogErrorEvent dialogErrorEvent)
SIPDialogEventListener
dialogErrorEvent
in interface SIPDialogEventListener
dialogErrorEvent
- Error event.public ListeningPoint[] getListeningPoints()
SipProvider
getListeningPoints
in interface SipProvider
public void addListeningPoint(ListeningPoint listeningPoint) throws ObjectInUseException
SipProvider
addListeningPoint
in interface SipProvider
listeningPoint
- - the listening point to add to this ListeningPointObjectInUseException
- if the supplied ListeningPoint is being used
by another SipProvider or if there is already a ListeningPoint for the given transport.public void removeListeningPoint(ListeningPoint listeningPoint) throws ObjectInUseException
SipProvider
removeListeningPoint
in interface SipProvider
listeningPoint
- the ListenPoint to be removed from this SipProvider.ObjectInUseException
- if the ListeningPoint is already in use or
is the last ListeningPoint associated with this SipProvider.public void removeListeningPoints()
public void setAutomaticDialogSupportEnabled(boolean automaticDialogSupportEnabled)
SipProvider
setAutomaticDialogSupportEnabled
in interface SipProvider
automaticDialogSupportEnabled
- - enables or disables automatic dialog support for this provider.SipStack
public boolean isAutomaticDialogSupportEnabled()
public void setDialogErrorsAutomaticallyHandled()
SipProviderExt
setDialogErrorsAutomaticallyHandled
in interface SipProviderExt
public boolean isDialogErrorsAutomaticallyHandled()
public SipListener getSipListener()
Copyright © 2015. All Rights Reserved.