I. SIP Concept
Session Initiation Protocol (SIP) is an application-layer control Protocol used to establish, modify, and terminate multimedia sessions. sessions can be IP phones, multimedia distribution, and multimedia meetings. It is the core protocol of the IETF multimedia data and control architecture (RFC3261 is the latest RFC document ). The main purpose is to solve the signaling control in the IP network and communicate with the softswitch platform, so as to form the next-generation value-added business platform and provide better value-added services for the telecom, banking, finance and other industries.
SIP is used to initiate a session. It can control the establishment and termination of multimedia sessions attended by multiple participants, and dynamically adjust and modify session attributes, such as session bandwidth requirements, transmitted media types (voice, video, and data), media codec formats, and support for multicast and unicast. The SIP protocol is based on text encoding. It draws a lot from the mature HTTP protocol and is easy to expand and implement. Therefore, it is very suitable for implementing internet-based Multimedia Conferencing Systems.
The SIP protocol uses the Client/Server model to establish user calls through communication with the Proxy Server.
The SIP terminal sends an "invite" message to the session destination terminal, which carries its own description information. The target terminal can accept or reject requests based on the "Invitation" information and its own capabilities. SIP can forward "invite" messages through an entity called "Proxy Server. The proxy server can determine the location of the target terminal and search for routes, perform authentication and authorization according to the requirements of the session terminal, and provide the call routing policy of the session terminal. SIP records the description information of each terminal through the "Registration server", including the address information, route information, and number information. Each SIP terminal can send a "Registration" message to the registration server, to register or update its description.
In addition, as an application layer protocol, SIP can use TCP or UDP on the transport layer. SIP supports IPv4 and IPv6.
Ii. Important Concepts
2.1 multimedia sessions
According to RFC2327, a Multimedia Session refers to a set of Multimedia senders and receivers and data streams from senders to receivers. For example, a multimedia meeting is a multimedia session. A session is determined by a group of user names, session IDs, network types, address types, and addresses of each unit.
2.2 User Agent
User Agent (UA), also known as SIP terminal, is a multimedia session terminal that supports the SIP protocol. For example, a SIP Phone, a SIP gateway, or a router that supports SIP.
2.3 user proxy client
A User Agent Client (UAC) is a device that actively sends Session requests during the establishment of a SIP session. For example, it is called a SIP terminal. When a contemporary server sends a session request to the called terminal, it is also used as a user proxy client.
2.4 user Proxy Server
A User Agent Server (UAS) is a device that receives Session requests when a SIP session is established. For example, the called SIP terminal. When receiving a session request from a calling terminal, the server serves as a user proxy server.
2.5 Proxy Server
The Proxy Server is a device that sends a session request to the called UA and sends a Response Message to the called UA. After receiving a session request from the caller UA, the proxy server first requests the registration server to find the called location and the call policy information of the master and called. The proxy server sends a session request to the called object only when the called object is found and the call is permitted.
2.6 redirect Server
The Redirect Server specifies the location where the called UA is called again. When the redirection server receives the Session Request message sent by the caller UA, it searches for the location information of the called UA and returns a location information to the caller UA so that the server can initiate a session request to the location again. This location can be either the location of the called UA or the location of a proxy server. The process of calling UA is the same as that of calling the called UA directly or calling the proxy server.
2.7 location Server
Location Server is a device that provides user proxy information for proxy servers and redirection servers. The location server records the information of the user proxy received by the registration server. The location server and the registration server are usually on the same device.
2.8 register a server
The registration server is a device that records the location information of the UA and provides the proxy server with information about the location information of the UA. In simple applications, the registration server and proxy server are usually on the same device.
Iii. functions and features of SIP
SIP has five basic functions:
- Determine user location: determine the location of the called SIP terminal. The most powerful feature of SIP is the user positioning function. SIP itself provides the registration function to the registration server. You can also use other locating servers, such as DNS and LDAP, to enhance the positioning function.
- Determine user availability: Determine whether the called session terminal can participate in this session. SIP supports multiple address descriptions and addressing methods, including user name @ host address, called Number @ PSTN gateway address, and general phone number (such as Tel: 01012345678. In this way, based on the called address, the SIP caller can identify whether the called address is on the traditional telephone network, and then initiate and establish a call to the called address through a gateway connected to the traditional telephone network.
- Determine user capabilities: Determine the media type and media parameters that the called terminal can use to participate in a session. The SIP terminal carries its own media type and media parameters during message interaction, so that sessions can clearly define the session capabilities of the other party.
- Establish a session: Set the session parameters of both parties. Both parties negotiate the media type and media parameters to establish a session.
- Manage sessions: You can change session parameters or stop sessions.
SIP has the following features:
- Standard openness. Various new functions, products, and services introduced by different carriers can be integrated, and users can choose freely.
- Configuration flexibility. It is compatible with multiple dial-up methods, wired devices, and wireless devices. It can be configured flexibly and can work with other systems.
- The system is scalable. With the expansion of the enterprise scale, the system can also be expanded.
- Supports remote users. Regardless of where the user is, the enterprise network can be extended.
- Potential to bring more competitive advantages to enterprises. New services and services based on SIP are introduced one after another.
- Consistency of various enterprise communication methods. Branch Offices, home offices, and travel staff use the same dial-up and system access methods for ease of management.
- Quick Start. The system changes rapidly when new branches are established, new employees are recruited, or employees are rescheduled to work or their work locations are changed.
- Easy to install and maintain. Non-professionals can also install or maintain the configurations of the SIP System.
Iv. How SIP works
1. Register
In a complete SIP System, all SIP terminals, as user agents, should register with the registration server, to inform the location information, session capability information, call policy, and so on.
Generally, when the SIP terminal is started or the configuration administrator performs the registration operation, it sends a registration request message (Register) to the registration server, which contains all the information to be registered. After receiving the registration request message, the registration server sends a Response Message to the terminal to inform it that the request message has been received. If the registration is successful, the message "successful" will be sent to the terminal. As shown in.
Figure 4-1 message interaction registered by the user agent with the SIP location Server
2. Create a call
The SIP protocol uses the client/server model. It establishes user calls through communication between UA and proxy server.
Figure 4-2 UA connection through proxy
For example, as shown in, call ). After dialing the phone number 2, vro1 1 sends a Session Request Message to the SIP server. The SIP server sends a session request message to vro2 2. After receiving the request, vro2 2 sends a response to the SIP server and calls 2. After receiving a response, the SIP server sends a Response Message to vro1 1. The response here includes two messages, a temporary response and a "successful" response. Shows message interaction throughout the process.
Figure 4-3 call flowchart of UA through Proxy Server
This example is a simple application that only uses one proxy server and does not use a registration server. In complex applications, You can have multiple proxy servers and registration servers.
3. Redirect call
After the SIP redirect server receives the Session Request message, it does not forward the Session Request message, but notifies the called SIP terminal address in the Response Message. The Calling terminal then sends a session request message directly to the called terminal. The called terminal will also send a response message directly to the caller. Shows the message interaction in the call process.
Figure 6-4 UA redirection call Flowchart
This is a common application. In principle, the redirection server can also reply a proxy server address to the calling terminal. The subsequent call process is the same as the call process using the proxy server.
Reprinted: http://myswirl.blog.163.com/blog/static/51318642201071410425729/