Java Doc for SipListener.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » sip » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » javax.sip 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.sip.SipListener

All known Subclasses:   test.tck.msgflow.callflows.refer.Referrer,  test.tck.msgflow.callflows.reinvite.Shootist,  examples.redirect.Shootist,  examples.cancel.Shootme,  examples.ims.Shootme,  test.tck.msgflow.callflows.router.Shootist,  examples.reinvite.Shootist,  test.load.concurrency.Shootist,  examples.subsnotify.Notifier,  test.load.subsnotify.Subscriber,  examples.nistgoodies.leakaudit.LeakingApp,  examples.forked.invite.Proxy,  examples.prack.Shootist,  test.tck.msgflow.callflows.redirect.Shootist,  test.tck.msgflow.callflows.forkedinvite.Proxy,  examples.tls.Shootme,  examples.nistgoodies.configlogger.Shootist,  examples.refer.Referee,  examples.forked.invite.Shootme,  test.tck.msgflow.callflows.refer.Referee,  test.tck.msgflow.callflows.subsnotify.Notifier,  test.tck.msgflow.callflows.forkedinvite.Shootist,  examples.subsnotify.Forker,  test.load.multidialog.Shootme,  test.load.concurrency.Shootme,  test.tck.msgflow.callflows.recroute.Shootist,  test.tck.msgflow.callflows.tls.Shootme,  test.tck.msgflow.callflows.reinvite.ReInviteTest,  examples.prack.Shootme,  test.tck.msgflow.callflows.redirect.Shootme,  test.tck.msgflow.callflows.router.Shootme,  test.tck.msgflow.callflows.redirect.AbstractRedirectTestCase,  examples.tpcc.Phone,  examples.tpcc.Controller4,  test.tck.msgflow.callflows.tls.TlsTest,  test.tck.msgflow.callflows.tls.Shootist,  examples.tpcc.Controller,  test.tck.msgflow.callflows.prack.AbstractPrackTestCase,  test.tck.msgflow.callflows.recroute.Proxy,  test.tck.msgflow.callflows.recroute.AbstractRecRouteTestCase,  test.tck.msgflow.callflows.refer.AbstractReferTestCase,  test.tck.msgflow.callflows.subsnotify.AbstractSubsnotifyTestCase,  examples.subsnotify.Subscriber,  examples.ims.Shootist,  test.unit.gov.nist.javax.sip.stack.AckReTransmissionTest,  test.tck.msgflow.callflows.prack.Shootist,  test.tck.msgflow.callflows.subsnotify.Subscriber,  test.tck.msgflow.callflows.prack.Shootme,  examples.publish.Publisher,  examples.noautodialog.Shootme,  examples.simplecallsetup.Shootist,  examples.nistgoodies.configlogger.Shootme,  examples.cancel.AbstractCancelTest,  examples.cancel.Shootist,  test.load.leakcheck.busy.Shootme,  examples.reinvite.Shootme,  examples.refer.Referer,  test.load.subsnotify.Notifier,  test.load.leakcheck.busy.Shootist,  test.tck.msgflow.callflows.forkedinvite.AbstractForkedInviteTestCase,  test.tck.msgflow.callflows.forkedinvite.Shootme,  examples.forked.invite.ForkedInviteTest,  examples.publish.Notifier,  examples.authorization.ShootistAuth,  examples.tls.Shootist,  test.tck.msgflow.callflows.subsnotify.Forker,  examples.busy.Shootme,  test.load.multidialog.Shootist,  examples.forked.invite.Shootist,  test.tck.msgflow.callflows.reinvite.Shootme,  examples.simplecallsetup.Shootme,  test.unit.gov.nist.javax.sip.stack.DeliverUnsolicitedNotifyTest,  examples.redirect.Shootme,  examples.busy.Shootist,  test.tck.msgflow.callflows.router.AbstractRouterTestCase,  examples.publish.Subscriber,  examples.noautodialog.Shootist,  test.tck.msgflow.callflows.recroute.Shootme,  examples.authorization.ShootmeAuth,
SipListener
public interface SipListener extends EventListener(Code)
This interface represents the application view to a SIP stack therefore defines the application's communication channel to the SIP stack. This interface defines the methods required by an applications to receive and process Events that are emitted by an object implementing the javax.sip.SipProvider interface.

The Events accepted by a SipListener may be one of four types:

  • RequestEvent - these are request messages emitted as events by the SipProvider. Request events represent request messages i.e. INVITE, that are received from the network to the application via the underlying stack implementation.
  • ResponseEvent - these are response messages emitted as events by the SipProvider. Response events represent Response messages i.e. 2xx's, that are received from the network to the application via the underlying stack implementation.
  • TimeoutEvent - these are timeout notifications emitted as events by the SipProvider. Timeout events represent timers expiring in the underlying SipProvider transaction state machine. These timeout's events notify the application that a retranmission is required or a transaction has timed out.
  • IOExceptionEvent - these are IO Exception notifications emitted as events by the SipProvider. IOException events represent failure in the underlying SipProvider IO Layer. These IO Exception events notify the application that a failure has occured while accessing a socket.
  • TransactionTerminatedEvent - these are Transaction Terminated notifications emitted as events by the SipProvider. TransactionTerminated events represent a transaction termination and notify the application of the termination.
  • DialogTerminatedEvent - these are Dialog Terminated notifications emitted as events by the SipProvider. DialogTerminated events represent a Dialog termination and notify the application of the termination.

An application will only receive Request, Response, Timeout, TransactionTerminated, DialogTerminated and IOException events once it has registered as an EventListener of a SipProvider. The application registers with the SipProvider by invoking the SipProvider.addSipListener(SipListener) passing itself as an argument.

Architecture:
This specification mandates a single SipListener per SipStack, and a unicast event model i.e. a SipProvider can only have one SipListener registered with it. This specification allows multiple SipProviders per SipStack and as such a SipListener can register with multiple SipProviders i.e there is a one-to-many relationship between a SipListener and a SipProvider.

Note: An application that implements the SipListener interface, may act as a proxy object and pass all events to higher level core application programming logic that is outside the scope of this specification. For example a SIP Servlet, or a JSLEE implementation can implement a back to back UA or Proxy core application respectively in there respective container environments utilizing this specification to talk the SIP protocol.

Messaging Model:
An application can send messages by passing javax.sip.message.Request and javax.sip.message.Response messages to that the following object:

Although this specification provides the capabilities to send messages both statelessly and statefully it is mandated that an application will not send the same message both statefully and statelessly. The messages sent by the application are not Event's as the event model is uni-directional from the SipProvider to the SipListener, i.e. the SipListener listens for Events from the SipProvider, but the SipProvider does not listen for Events on the SipListener. The rationale is the application knows when to initiate requests and responses i.e setup a call or respond to a network event, however an application doesn't know when it will receive a network event, hence the application must listen for these network events.

Session Negotiation
There are special rules for message bodies of Request and Responses that contain a session description. SIP uses an offer/answer model where one User Agent sends a session description, called the offer, which contains a proposed description of the session. The other User Agent responds with another session description, called the answer, which indicates which communications means are accepted. In this specification, offers and answers can only appear in INVITE requests and Responses, and ACK. The Session Description Protocol (SDP) RFC2327 MUST be supported by all user agents as a means to describe sessions, and its usage for constructing offers and answers MUST follow the procedures defined in RFC3261 . The SDP protocol is described in Java by JSR 141
See Also:   SipProvider
See Also:   RequestEvent
See Also:   ResponseEvent
See Also:   TimeoutEvent
See Also:   IOExceptionEvent
See Also:   TransactionTerminatedEvent
See Also:   DialogTerminatedEvent
author:
   BEA Systems, NIST
version:
   1.2





Method Summary
public  voidprocessDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent)
     Process an asynchronously reported DialogTerminatedEvent. When a dialog transitions to the Terminated state, the stack keeps no further records of the dialog.
public  voidprocessIOException(IOExceptionEvent exceptionEvent)
     Process an asynchronously reported IO Exception.
public  voidprocessRequest(RequestEvent requestEvent)
     Processes a Request received on a SipProvider upon which this SipListener is registered.

Handling Requests:
When the application receives a RequestEvent from the SipProvider the RequestEvent may or may not belong to an existing dialog of the application.

public  voidprocessResponse(ResponseEvent responseEvent)
     Processes a Response received on a SipProvider upon which this SipListener is registered.

Handling Responses:
When the application receives a ResponseEvent from the SipProvider the ResponseEvent may or may not correlate to an existing Request of the application.

public  voidprocessTimeout(TimeoutEvent timeoutEvent)
     Processes a retransmit or expiration Timeout of an underlying Transaction handled by this SipListener.
public  voidprocessTransactionTerminated(TransactionTerminatedEvent transactionTerminatedEvent)
     Process an asynchronously reported TransactionTerminatedEvent. When a transaction transitions to the Terminated state, the stack keeps no further records of the transaction.



Method Detail
processDialogTerminated
public void processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent)(Code)
Process an asynchronously reported DialogTerminatedEvent. When a dialog transitions to the Terminated state, the stack keeps no further records of the dialog. This notification can be used by applications to clean up any auxiliary data that is being maintained for the given dialog.
Parameters:
  dialogTerminatedEvent - -- an event that indicates that thedialog has transitioned into the terminated state.
since:
   v1.2



processIOException
public void processIOException(IOExceptionEvent exceptionEvent)(Code)
Process an asynchronously reported IO Exception. Asynchronous IO Exceptions may occur as a result of errors during retransmission of requests. The transaction state machine requires to report IO Exceptions to the application immediately (according to RFC 3261). This method enables an implementation to propagate the asynchronous handling of IO Exceptions to the application.
since:
   v1.2
Parameters:
  exceptionEvent - --The Exception event that is reported to the application.



processRequest
public void processRequest(RequestEvent requestEvent)(Code)
Processes a Request received on a SipProvider upon which this SipListener is registered.

Handling Requests:
When the application receives a RequestEvent from the SipProvider the RequestEvent may or may not belong to an existing dialog of the application. The application can be determine if the RequestEvent belongs to an existing dialog by checking the server transaction of the RequestEvent.

  • If the server transaction equals null the RequestEvent does not belong to an existing dialog and the application must determine how to handle the RequestEvent. If the application decides to forward the Request statelessly no transactional support is required and it can simply pass the Request of the RequestEvent as an argument to the SipProvider.sendRequest(Request) method. However if the application determines to respond to a Request statefully it must request a new server transaction from the SipProvider.getNewServerTransaction(Request) method and use this server transaction to send the Response based on the content of the Request. If the SipProvider throws TransactionAlreadyExistsException when the application requests a new server transaction to handle a Request the current RequestEvent is a retransmission of the initial request from which the application hadn't requested a server transaction to handle it, i.e. this exception handles the race condition of an application informing the SipProvider that it will handle a Request and the receipt of a retransmission of the Request from the network to the SipProvider.
  • If the server transaction does NOT equal null the application determines its action to the RequestEvent based on the content of the Request information.

User Agent Server (UAS) Behaviour:
A UAS application decides whether to accept the an invitation from a UAC. The UAS application can accept the invitation by sending a 2xx response to the UAC, a 2xx response to an INVITE transaction establishes a session. For 2xx responses, the processing is done by the UAS application, to guarantee the three way handshake of an INVITE transaction. This specification defines a utility thats enables the SipProvider to handle the 2xx processing for an INVITE transaction, see the SipStack.isRetransmissionFilterActive method. If the invitation is not accepted, a 3xx, 4xx, 5xx or 6xx response is sent by the application, depending on the reason for the rejection. Alternatively before sending a final response, the UAS can also send provisional responses (1xx) to advise the UAC of progress in contacting the called user. A UAS that receives a CANCEL request for an INVITE, but has not yet sent a final response, would "stop ringing" and then respond to the INVITE with a specific 487 Error response.

General Proxy behaviour:
In some circumstances, a proxy application MAY forward requests using stateful transports without being transaction stateful, i.e. using the SipProvider.sendRequest(Request) method, but using TCP as a transport. For example, a proxy application MAY forward a request from one TCP connection to another transaction statelessly as long as it places enough information in the message to be able to forward the response down the same connection the request arrived on. This is the responsibility of the application and not the SipProvider. Requests forwarded between different types of transports where the proxy application takes an active role in ensuring reliable delivery on one of the transports must be forwarded using the stateful send methods on the SipProvider.

Stateful Proxies:
A stateful proxy MUST create a new server transaction for each new request received, either automatically generated by the SipProvider, if the request matches an existing dialog or by the an application call on the SipProvider if it decides to respond to the request statefully. The proxy application determines where to route the request, choosing one or more next-hop locations. An outgoing request for each next-hop location is processed by its own associated client transaction. The proxy application collects the responses from the client transactions and uses them to send responses to the server transaction. When an application receives a CANCEL request that matches a server transaction, a stateful proxy cancels any pending client transactions associated with a response context. A stateful proxy responds to the CANCEL rather than simply forwarding a response it would receive from a downstream element.

For all new Requests, including any with unknown methods, an element intending to stateful proxy the Request determines the target(s) of the request. A stateful proxy MAY process the targets in any order. A stateful proxy must have a mechanism to maintain the target set as responses are received and associate the responses to each forwarded request with the original request. For each target, the proxy forwards the request following these steps:

  • Make a copy of the received request.
  • Update the Request-URI.
  • Update the Max-Forwards header.
  • Optionally add a Record-route header.
  • Optionally add additional headers.
  • Postprocess routing information.
  • Determine the next-hop address, port, and transport.
  • Add a Via header.
  • Add a Content-Length header if necessary.
  • Forward the new request using the ClientTransaction.sendRequest method.
  • Process all responses recieved on the SipListener.processResponse(ResponseEvent) method.
  • NOT generate 100 (Trying) responses to non-INVITE requests.

A stateful proxy MAY transition to stateless operation at any time during the processing of a request, as long as it did nothing that would prevent it from being stateless initially i.e. forking or generation of a 100 response. When performing such a transition, any state already stored is simply discarded.

Forking Requests:
A stateful proxy application MAY choose to "fork" a request, routing it to multiple destinations. Any request that is forwarded to more than one location MUST be forwarded using the stateful send methods on the SipProvider.

Stateless Proxies:
As a stateless proxy does not have any notion of a transaction, or of the response context used to describe stateful proxy behavior, requestEvent.getServerTransaction() == null; always return true . The transaction layer of the SipProvider implementation is by-passed. For all requests including any with unknown methods, an application intending to stateless proxy the request MUST:

  • Validate the request.
  • Preprocess routing information.
  • Determine a single target(s) for the request.
  • Forward the request to the target using the SipProvider.sendRequest(Request) method.
  • NOT perform special processing for CANCEL requests.

Parameters:
  requestEvent - -requestEvent fired from the SipProvider to the SipListenerrepresenting a Request received from the network.



processResponse
public void processResponse(ResponseEvent responseEvent)(Code)
Processes a Response received on a SipProvider upon which this SipListener is registered.

Handling Responses:
When the application receives a ResponseEvent from the SipProvider the ResponseEvent may or may not correlate to an existing Request of the application. The application can be determine if the ResponseEvent belongs to an existing Request by checking the client transaction of the ResponseEvent.

  • If the the client transaction equals null the ResponseEvent does not belong to an existing Request and the Response is considered stray, i.e. stray response can be identitied, if responseEvent.getClientTransaction() == null;. Handling of these "stray" responses is dependent on the application i.e. a proxy will forward them statelessly using the SipProvider.sendResponse(Response) method, while a User Agent will discard them.
  • If the client transaction does NOT equal null the application determines it action to the ResponseEvent based on the content of the Response information.

User Agent Client (UAC) behaviour:
After possibly receiving one or more provisional responses (1xx) to a Request, the UAC will get one or more 2xx responses or one non-2xx final response. Because of the protracted amount of time it can take to receive final responses to an INVITE, the reliability mechanisms for INVITE transactions differ from those of other requests. A UAC needs to send an ACK for every final Response it receives, however the procedure for sending the ACK depends on the type of Response. For final responses between 300 and 699, the ACK processing is done by the transaction layer i.e. handled by the implementation. For 2xx responses, the ACK processing is done by the UAC application, to guarantee the three way handshake of an INVITE transaction. This specification defines a utility thats enables the SipProvider to handle the ACK processing for an INVITE transaction, see the SipStack.isRetransmissionFilterActive method.
A 2xx response to an INVITE establishes a session, and it also creates a dialog between the UAC that issued the INVITE and the UAS that generated the 2xx response. Therefore, when multiple 2xx responses are received from different remote User Agents, i.e. the INVITE forked, each 2xx establishes a different dialog and all these dialogs are part of the same call. If an INVITE client transaction returns a TimeoutEvent rather than a response the UAC acts as if a 408 (Request Timeout) response had been received from the UAS.

Stateful Proxies:
A proxy application that handles a response statefully must do the following processing:

  • Find the appropriate response context.
  • Remove the topmost Via header.
  • Add the response to the response context.
  • Check to determine if this response should be forwarded immediately.
  • When necessary, choose the best final response from the response context. If no final response has been forwarded after every client transaction associated with the response context has been terminated, the proxy must choose and forward the "best" response from those it has seen so far.

Additionally the following processing MUST be performed on each response that is forwarded.

  • Aggregate authorization header values if necessary.
  • Optionally rewrite Record-Route header values.
  • Forward the response using the ServerTransaction.sendResponse(Response) method.
  • Generate any necessary CANCEL requests.

Stateless Proxies:
As a stateless proxy does not have any notion of transactions, or of the response context used to describe stateful proxy behavior, responseEvent.getClientTransaction == null; always return true . Response processing does not apply, the transaction layer of the SipProvider implementation is by-passed. An application intending to stateless proxy the Response MUST:

  • Inspect the sent-by value in the first Via header.
  • If that address matches the proxy, the proxy MUST remove that header from the response.
  • Forward the resulting response to the location indicated in the next Via header using the SipProvider.sendResponse(Response) method.

Parameters:
  responseEvent - -the responseEvent fired from the SipProvider to theSipListener representing a Response received from the network.



processTimeout
public void processTimeout(TimeoutEvent timeoutEvent)(Code)
Processes a retransmit or expiration Timeout of an underlying Transaction handled by this SipListener. This Event notifies the application that a retransmission or transaction Timer expired in the SipProvider's transaction state machine. The TimeoutEvent encapsulates the specific timeout type and the transaction identifier either client or server upon which the timeout occured. The type of Timeout can by determined by: timeoutType = timeoutEvent.getTimeout().getValue();
Parameters:
  timeoutEvent - -the timeoutEvent received indicating either the messageretransmit or transaction timed out.



processTransactionTerminated
public void processTransactionTerminated(TransactionTerminatedEvent transactionTerminatedEvent)(Code)
Process an asynchronously reported TransactionTerminatedEvent. When a transaction transitions to the Terminated state, the stack keeps no further records of the transaction. This notification can be used by applications to clean up any auxiliary data that is being maintained for the given transaction.
Parameters:
  transactionTerminatedEvent - -- an event that indicates that thetransaction has transitioned into the terminated state.
since:
   v1.2



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.