Adding speech features to Java EE using the SIP servlet

Source: Internet
Author: User
Tags response code

Session Initiation Protocol,sip is a signaling protocol that establishes, modifies, and terminates a session between two endpoints. SIP can be used to establish a multicast session for two-party calls, multiparty calls, or even Internet calls, multimedia calls, and multimedia distribution. The JSR 116:sip Servlet API is a server-side interface that describes containers for SIP components and services. The SIP servlet is a servlet running in the SIP container, similar to the HTTP servlet, but provides support for the SIP protocol. The SIP and sip servlet are the underlying technology for many popular applications based on remote communications, which provide a variety of services such as VOICE-OVER-IP (VoIP), instant messaging, online and buddy list management, and web conferencing.

SIP and sip servlet are also important for enterprises. Combined with Java EE technology, the SIP servlet can be used to add rich media interactivity to enterprise applications. The JSR 289:sip servlet v1.1 updates the SIP servlet API and defines a standard application programming model for integrating the SIP servlet and Java EE components together. The SIP servlet will play a more important role in the next generation of remote communication services.

This technical article covers some of the basic underlying concepts of the SIP and sip servlet. This article also provides a sample application that uses the SIP servlet and HTTP servlet to provide VoIP telephony services.

What is SIP?

An easy way to introduce SIP is to start with the application scenario. Let's assume that user A wants to establish a call with user B. In remote communication settings, user A and B communicate through the user agent. An example of a user agent is a software phone-a software program for creating phone calls on the Internet. Another example is VoIP phone--, a telephone that uses VoIP. The steps required to establish a call are listed below:

A invite B to start the session. As part of the invitation, A will describe the media that you are supporting.

B receive an invitation and send a prompt response to a, and then evaluate the invitation.

When B is ready to accept the invitation, it sends a receipt to a. As part of the receipt, B describes the media that you are supporting.

A analyze receipts received from B and determine whether the media supported by B and A are the same. If A and B support the same media, a call is established between them. The media specified in the invitation can simplify the creation of the call.

Figure 1 illustrates the steps to establish a call.

Figure 1. To establish a call

SIP provides a standard way to perform these steps. It completes these steps by defining a specific request method, response, response code, and the head of the signal transmission and call control. The protocol, which has been standardized by the Internet Engineering Task Force (IETF) based on RFC3261, has been adopted as a standard signaling protocol by the 3rd Generation Partner Project (3GPP) and has become the IP Multimedia Subsystem (IP multim Edia subsystem,ims) A permanent element in the schema.

What is the relationship between SIP and HTTP?

People often ask whether SIP uses HTTP as the underlying protocol. The answer is in the negative. SIP is a protocol that operates at the same level as HTTP (the application tier) and uses TCP, UDP, or SCTP as the underlying protocol. However, there are many similarities between SIP and HTTP. For example, like HTTP, the SIP is text-based and user-readable. SIP uses a "request response" mechanism with specific methods, response codes, and headers, which is similar to HTTP. A significant difference between HTTP and sip is that the request response mechanism in the SIP is asynchronous-the request does not need to be followed immediately by the corresponding response. In fact, a SIP request can cause one or more requests to be generated.

SIP is a peer-to-peer protocol. This means that the user agent can be either a server or a client. This is another difference between SIP and HTTP, in which the client is always the client and the server is always the server.

SIP supports the following request methods and response codes:

Request Method:

REGISTER. The client uses it to register an address with the SIP server.

INVITE. Instructs users and servers to be invited to participate in a session. The body of this message includes a session description, and the user or service is invited to participate in the session.

Ack. Confirm that the client has received the final response to the INVITE request. This method is used only with INVITE requests.

CANCEL. Used to cancel a pending request.

BYE. Sent by the user agent client to indicate to the server that it wants to terminate the call.

OPTIONS. Used to query the server for the functionality associated with it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.