私有网络的 IP语音业务实现方法及系统 技术领域 Method and system for implementing IP voice service in private network
本发明涉及数据通信技术领域, 特别涉及一种在包括采用网络地址 转换( NAT )技术组网的私有网络在内的网络上实现 IP语音业务( VoIP ) 的方法及系统。 发明背景 The present invention relates to the field of data communication technology, and in particular, to a method and system for implementing an IP voice service (VoIP) on a network including a private network using a network address translation (NAT) technology. Background of the invention
传统的语音业务采用电路交换技术, 即通话双方通过公共交换电话 网 (PSTN )建立一条固定带宽 (64kbii S ) 的电路, 这使得低时延、 低 失真的实时通信服务质量(QoS )得到保证, 但在这种方式下网络带宽 利用率低, 通讯成本高, 而且增值业务的推广比较困难。 The traditional voice service uses circuit switching technology, that is, the two parties of the call establish a fixed bandwidth (64kbii S ) circuit through the public switched telephone network (PSTN), which guarantees low-latency and low-distortion real-time communication service quality (QoS). However, in this way, the network bandwidth utilization is low, communication costs are high, and the promotion of value-added services is difficult.
VoIP ( Voice over IP )是指在以 IP为网络层协议的计算机网络中进 行语音传送的业务, 简称 IP语音业务。 计算机通讯采用分组交换技术, 称之为 "分组" ( packet ), 网络中的各通讯节点存储并转发分组。 因此, VoIP属于分组语音通信的范畴, 是以 IP为标志的网络分組化和以多媒 体为目标的网络业务综合化两大主流技术融合的结果。 分组交换的特点 是网络利用率高,通讯成本低, 而且 IP网络作为开放式网络很容易快速 推广新业务。 VoIP (Voice over IP) refers to the service of voice transmission in a computer network using IP as the network layer protocol, referred to as the IP voice service. Computer communication uses packet switching technology, which is called "packet", and each communication node in the network stores and forwards packets. Therefore, VoIP belongs to the category of packet voice communication, which is the result of the integration of two mainstream technologies: network packetization marked by IP and network service integration targeted at multimedia. The characteristics of packet switching are high network utilization, low communication costs, and IP networks as open networks make it easy to quickly promote new services.
在计算机网络上进行语音通信的研究源自 70年代。进入 90年代后, 特别是近几年, 随着 Internet在全球范围的兴起和语音编码技术的发展, VoIP取得突破性进展并得到了实际应用。 其发展大致分为以下三个阶 段: Research on voice communications over computer networks dates back to the 1970s. After entering the 1990s, especially in recent years, with the rise of the Internet worldwide and the development of speech coding technology, VoIP has made breakthrough progress and has been practically applied. Its development is roughly divided into the following three stages:
(1) 萌芽期: Internet出现后, 人们首先尝试了让两台 PC机通过
IP网络传送语音,这是 VoIP最初的一种形式。在这一阶段,人们对 VoIP 的认识艮肤浅, 市场也不明确。 (1) Germination period: After the Internet appeared, people first tried to let two PCs pass IP networks carry voice, which was an original form of VoIP. At this stage, people's understanding of VoIP is superficial and the market is unclear.
(2) 发展期: 在 VoIP诸多优势的吸引下, 很多电信公司认识到仅 在 PC机之间实现 IP电话远远不能满足用户的需要, 因此目光投向了众 多的 PSTN用户,这就导致 IP电话网关的出现。 IP电话网关将 PSTN网 络和 IP网络连接起来, 提供电话到电话, PC到电话, 电话到 PC等多 种 VoIP业务形式。 这一阶段是 IP电话迅速发展的时期。 (2) Development period: attracted by the many advantages of VoIP, many telecommunications companies realize that IP phones between PCs are far from meeting the needs of users, so they are focusing on many PSTN users, which leads to IP phones. The emergence of the gateway. The IP phone gateway connects the PSTN network and the IP network, and provides a variety of VoIP service forms such as phone to phone, PC to phone, and phone to PC. This stage is a period of rapid development of IP phones.
(3) 成熟期: IP 电话应用的发展在未来将进入成熟期, 具有通讯 采用统一的标准, 全球各电信厂家的语音设备可以互通、 VoIP话音质量 接近传统电话质量等特点。 (3) Maturity period: The development of IP telephony applications will enter a mature period in the future, with unified standards for communication, voice equipment of telecommunications manufacturers around the world can communicate with each other, and VoIP voice quality is close to traditional telephone quality.
实现 IP语音业务的通信协议包括有语音通信控制协议、话音信息传 送协议、 会议电话控制协议和实时控制协议等。 其中, 语音通信控制协 议即电信网中的呼叫控制信令, 包括地址信息、 用户状态信息、 双音多 频(DTMF )信号等, 一般采用传输控制协议(TCP )作为传输层协议。 话音信息传送协议规定了话音分组如何封装、 复用和传送, 包括各种语 音编码分组如何组装和标识, 要求要实时传送, 只能用用户数据报协议 ( UDP )作为传输层协议。 IP电话利用实时传输协议(RTP )适配分组 语音数据, RTP可传送分组的时间戳、 分组序号等信息,支持 QoS监视 和多数据流合并。 另外, 为确保实时性, 还选用资源预留协议(RSVP ) 为呼叫保留网络资源。 目前 VoIP 的实现均是在开始呼叫的时候, 首先 建立呼叫信令通道, 进行信令交互和协商以后, 建立逻辑通道即语音通 道, 逻辑通道的地址需要在呼叫信令通道的报文中传送。 The communication protocols for implementing IP voice services include voice communication control protocols, voice information transmission protocols, conference call control protocols, and real-time control protocols. Among them, the voice communication control protocol, that is, call control signaling in a telecommunications network, includes address information, user status information, and dual-tone multi-frequency (DTMF) signals. Generally, Transmission Control Protocol (TCP) is used as a transport layer protocol. The voice information transfer protocol specifies how voice packets are encapsulated, multiplexed, and transmitted, including how various voice-encoded packets are assembled and identified. It is required to be transmitted in real time, and only User Datagram Protocol (UDP) can be used as the transport layer protocol. IP phones use real-time transmission protocol (RTP) to adapt to packet voice data. RTP can transmit information such as packet timestamps and packet sequence numbers, and supports QoS monitoring and multi-data stream merging. In addition, to ensure real-time performance, a Resource Reservation Protocol (RSVP) is also selected to reserve network resources for calls. At present, when VoIP is implemented, a call signaling channel is first established. After signaling interaction and negotiation, a logical channel, that is, a voice channel is established. The address of the logical channel needs to be transmitted in the message of the call signaling channel.
私有网络是指使用私有 IP地址的内部网络, 如企业网。 当今绝大部 分企业网都是实施 TCP/IP协议的内联网, 用户使用 DHCP协议动态分 配私有 IP地址,在私网上划分多个网段,用户数据往往越过本地网段在
私网内的各子网间传送。 企业网内部, 同一地点的分支或总部使用第三 层交换技术(也称 IP交换技术、 高速路由技术等, 是一种利用第三层协 议中信息来加强第二层交换功能的机制)通过以太网进行连接, 而分支 业网到公网一般有唯一的出口, 用户访问公网时, 必须借助于代理服务 器的 NAT功能。 A private network is an internal network that uses a private IP address, such as an enterprise network. Most of today's corporate networks are intranets that implement the TCP / IP protocol. Users use DHCP to dynamically assign private IP addresses and divide multiple network segments on the private network. User data often crosses the local network segment. Transfer between subnets in the private network. Within the corporate network, the branch or headquarters at the same location uses Layer 3 switching technology (also known as IP switching technology, high-speed routing technology, etc., which is a mechanism that uses the information in the Layer 3 protocol to strengthen the Layer 2 switching function) through Ethernet. Networks are connected, and the branch network usually has a unique exit from the public network. When users access the public network, they must rely on the NAT function of the proxy server.
NAT即地址转换或地址代理, 用来实现私有网络地址与公有网络地 址之间的转换。 私有地址是指内部网络(局域网内部) 的主机地址, 而 公有地址是局域网的外部地址(在因特网上的全球唯一的 IP地址)。 因 特网地址分配组织规定以下的三个网络地址段保留用做私有地址: NAT is the address translation or address proxy, which is used to implement the translation between private network addresses and public network addresses. The private address refers to the host address of the internal network (inside the local area network), and the public address is the external address of the local area network (the globally unique IP address on the Internet). The Internet address allocation organization specifies that the following three network address segments are reserved for private addresses:
10.0.0.0 ~ 10.255.255.255 10.0.0.0 ~ 10.255.255.255
172.16.0.0 ~ 172.31.255.255 172.16.0.0 ~ 172.31.255.255
192.168.0.0 ~ 192.168.255.255 192.168.0.0 ~ 192.168.255.255
也就是说这三个网络地址段不会在因特网上被分配, 但可以在一个 私有(局域网) 内部网络使用。 各个私网根据在可预见的将来主机数量 的多少,选择一个合适的网络地址。不同私网的内部网络地址可以相同。 In other words, these three network address segments will not be allocated on the Internet, but can be used on a private (local area network) internal network. Each private network selects an appropriate network address based on the number of hosts in the foreseeable future. The internal network addresses of different private networks can be the same.
NAT技术在如企业网的私网上被广泛使用, 以克服地址空间的限制 和增加安全性, 以及解决多个子网的联网问题。 网络地址转换通过复用 TCP或 UDP端口号, 提供把多个内部(私网) IP地址转换成外部 (公 网) IP地址的能力。 关于地址转换的方式, 又可分为多种类型。 有的使 用同一公网地址, 用不同端口号来区分不同连接; 有的在地址池中取得 一个公网地址, 按照一定算法取得端口号。 NAT technology is widely used on private networks such as corporate networks to overcome the limitation of address space and increase security, as well as to solve the networking problem of multiple subnets. Network address translation provides the ability to convert multiple internal (private network) IP addresses to external (public network) IP addresses by multiplexing TCP or UDP port numbers. There are many types of address translation methods. Some use the same public network address and use different port numbers to distinguish different connections; some obtain a public network address in the address pool and obtain the port number according to a certain algorithm.
对于 NAT的多种方式, 可以总结出一个共有的特点, 即私网用户要 使用公网的服务时, 需要通过 NAT得到一个公网地址(包括 IP地址和 端口号), 这个转换的对应关系记录在 NAT路由器的一个地址端口对应
表中, 表中对应的两者分别为内部私有 IP地址, 和发往外部的 IP报文 的源端口号,后者也是从外部收到 IP报文的目的端口号。在公网的节点 看来,这个私网用户的地址就是 NAT转换后的公网地址,如果要向这个 私网用户发送数据, 就直接发送这个公网地址, 路由器通过查询地址端 口对应表中存储的对应关系, 将数据转发给私网用户。 For the multiple methods of NAT, a common feature can be summarized. When private network users want to use the services of the public network, they need to obtain a public network address (including the IP address and port number) through NAT. Corresponds to an address port on the NAT router In the table, the corresponding two in the table are the internal private IP address and the source port number of the IP packet sent to the outside, which is also the destination port number of the IP packet received from the outside. From the perspective of nodes on the public network, the address of this private network user is the public network address after NAT conversion. If you want to send data to this private network user, you directly send this public network address. The router stores the address in the address-port correspondence table by querying it. The corresponding relationship is forwarded to the private network user.
简单来说, 地址转换技术( NAT )是将内部 IP地址和端口替换为外 部网络 IP地址和端口, 以及反向的转换, NAT技术的优点在于: To put it simply, address translation technology (NAT) is to replace the internal IP address and port with the external network IP address and port, and reverse translation. The advantages of NAT technology are:
1、 提供内部网络的主机访问网外资源; 1. Provide hosts on the internal network to access resources outside the network;
2、 为内部主机提供了 "隐私(Privacy )" 保护, 提高安全性; 2. Provide "Privacy" protection for internal hosts to improve security;
3、 解决 IP地址资源问题。 3. Solve the problem of IP address resources.
当私网用户使用现有的 VoIP系统应用 VoIP业务时, 会遇到下列问 题:私网 PC向公网 PC或网关发起呼叫的时候,可能会出现单通或无法 通话; 公网 PC或电话(通过网关)拨打位于私网中的 PC时, 通话无法 建立。原因就在于: 当 PC向公网被叫 PC或网关发起呼叫的时候, 通过 NAT转换, 私网 PC的呼叫信令能正确发送到公网, 但由于呼叫信令的 数据部分中包含的媒体信道的源地址和源端口号是属于私网的, NAT路 由器只能对 IP包头的源地址和源端口号进行转换, 无法修改数据部分, 所以被叫方无法获知主叫方媒体信道的地址, 所以造成单通或者不通的 现象。 当公网 PC或电话(通过网关)向私网 PC发起呼叫时, 被叫方的 VoIP服务器查询到的被叫呼叫信道(或控制信道)地址是私网地址, 所 以无法与被叫 PC建立呼叫连接 发明内容 When private network users use the existing VoIP system to apply VoIP services, they will encounter the following problems: When a private network PC initiates a call to a public network PC or gateway, a single-way or unavailable call may occur; the public network PC or phone ( When a PC on the private network is dialed through the gateway, the call cannot be established. The reason is: When the PC initiates a call to the called PC or gateway on the public network, the call signaling of the private network PC can be correctly sent to the public network through NAT conversion. The source address and source port number belong to the private network. The NAT router can only translate the source address and source port number of the IP packet header. The data part cannot be modified. Therefore, the called party cannot know the address of the media channel of the calling party. Causes a single-pass or no-pass phenomenon. When a public network PC or phone initiates a call (via a gateway) to a private network PC, the called channel (or control channel) address queried by the called party's VoIP server is a private network address, so a call cannot be established with the called PC Connection Summary
本发明的目的就在于提供一种在包括以 NAT技术组网的私有网络 在内的网络上实现 IP语音业务的方法及系统,使私网用户可以应用 VoIP
业务。 The purpose of the present invention is to provide a method and system for implementing IP voice services on a network including a private network networked with NAT technology, so that private network users can apply VoIP business.
本发明一种私有网络的 IP语音业务的实现方法, 至少包括以下步 骤: A method for implementing an IP voice service in a private network according to the present invention includes at least the following steps:
a ) 私网用户 PC客户端向 VoIP服务器发送登录请求消息后, 向 地址服务器发起 n次 TCP/UDP连接, n的取值为私网用户 PC 客户端与 VoIP服务器完成一次通话需要建立的呼叫信令通道 和逻辑通道的总的通道数; a) After the private network user PC client sends a login request message to the VoIP server, it initiates n TCP / UDP connections to the address server. The value of n is the call letter that the private network user PC client needs to establish to complete a call with the VoIP server. Let the total number of channels and logical channels;
b ) 地址服务器将所接收的连接报文中的经过 NAT转换之后的公 网地址和端口号分别发送给 VoIP服务器和私网用户 PC客户 c ) VoIP服务器将对应呼叫信令通道的公网地址和端口号记录在 该 PC客户端的地址域中, 私网用户 PC客户端将对应逻辑通 道的公网地址和端口号记录在相应的地址域中。 b) the address server sends the public network address and port number in the received connection packet after NAT conversion to the VoIP server and the private network user PC client c) the VoIP server sends the public network address and The port number is recorded in the address field of the PC client, and the private network user PC client records the public network address and port number of the corresponding logical channel in the corresponding address field.
根据上述本发明方法, 进一步包括以下步骤: According to the method of the present invention, the method further includes the following steps:
d ) 私网用户的 PC客户端设置定时机制,使超过规定时间没有接 收到呼叫报文时, 重复步骤 a )、 步骤 b )、 步骤 c )。 根据上述本发明方法, 所述的步骤 b ) 中, 地址服务器直接将对应 逻辑通道的经过 NAT转换之后的公网地址和端口号发送给私网用户 PC 客户端。 d) The PC client of the private network user sets a timing mechanism so that when no call message is received within the prescribed time, repeat steps a), b), and c). According to the method of the present invention, in step b), the address server directly sends the public network address and port number of the corresponding logical channel after NAT conversion to the PC client of the private network user.
根据上述本发明方法, 所迷的步骤 b ) 中, 地址服务器将所接收的 连接报文中的经过 NAT转换之后的公网地址和端口号发送给 VoIP服务 器, 由 VoIP服务器将对应逻辑通道的公网地址和端口号在响应私网用 户 PC客户端登录请求的应答消息中发送给该 PC客户端。 According to the method of the present invention, in step b), the address server sends the public network address and port number after NAT conversion in the received connection packet to the VoIP server, and the VoIP server sends the public address of the corresponding logical channel. The network address and port number are sent to the PC client in a response message in response to the PC client login request from the private network user.
本发明一种实现私有网络 IP语音业务的系统, 至少包括通过 IP网 络连接的 IP语音业务(VoIP )服务器、 PC客户端、 网守、 网关以及通
过公共交换电话网连接的交换设备和电话终端设备, 其中 PC客户端提 供 PC用户进行语音通话, 实现协议处理和呼叫控制以及语音数据的转 换, VoIP服务器实现 PC客户端的登录认证、 响应呼叫接入请求以及进 行呼叫接续的控制, 网关是连接 IP网络与公共交换电话网的设备, 网守 提供网关地址的查找功能; 其特征在于: A system for implementing a private network IP voice service includes at least an IP voice service (VoIP) server, a PC client, a gatekeeper, a gateway, and a communication terminal connected through an IP network. Switching equipment and telephone terminal equipment connected through the public switched telephone network. The PC client provides PC users for voice calls, protocol processing and call control, and conversion of voice data. The VoIP server implements PC client login authentication and responds to call access. Request and control of call connection. The gateway is a device that connects the IP network with the public switched telephone network. The gatekeeper provides the function of finding the gateway address. It is characterized by:
该系统进一步包括一地址代理服务器, 通过 IP网络与系统连接, 其 接收私网用户 PC客户端在登录后发送的 TCP UDP连接报文,并将其中 的经过 NAT转换之后的公网地址和端口号分别发送给 VoIP服务器和私 网用户的 PC客户端; The system further includes an address proxy server, which is connected to the system through the IP network, and receives a TCP UDP connection packet sent by a private client PC client after login, and converts the public network address and port number thereof after NAT conversion. Send to VoIP server and PC client of private network user respectively;
所述的 VoIP服务器将对应呼叫信令通道的地址记录在该 PC客户端 的地址域中, 私网用户 PC客户端将对应逻辑通道的地址记录在相应的 地址域,为私网用户 PC客户端与 VoIP服务器实现通话预留呼叫信令通 道和還辑通道。 The VoIP server records the address of the corresponding call signaling channel in the address field of the PC client, and the private network user PC client records the address of the corresponding logical channel in the corresponding address field. The VoIP server implements the reserved call signaling channel and the reversion channel during the call.
进一步的, 所述的 VoIP服务器由业务服务器和用户服务器组成。 本发明通过在现有的 VoIP 系统中增加地址代理服务器, 并在私网 PC客户端登录阶段与地址代理服务器建立数据连接, 把 PC客户端和 VoIP服务器之间完成通话所需要建立的通道, 包括呼叫信令通道、 逻辑 通道,在登录阶段就预先建立,并用每个通道在经过 NAT转换之后的源 地址源端口号(公网地址)代替相应的 PCC私网地址, 实际起到了预留 呼叫信令通道和逻辑通道(即语音通道)的作用, 实现 VoIP业务在 NAT 组网方式中的应用。 附图简要说明 Further, the VoIP server is composed of a service server and a user server. By adding an address proxy server to the existing VoIP system and establishing a data connection with the address proxy server during the login phase of the private network PC client, the present invention includes a channel needed to establish a call between the PC client and the VoIP server, including Call signaling channels and logical channels are pre-established during the login phase, and the corresponding PCC private network address is replaced by the source address source port number (public network address) of each channel after NAT conversion, which actually serves to reserve the call information. The role of the channel and logical channel (that is, the voice channel), to achieve the application of VoIP services in NAT networking. Brief description of the drawings
图 1为本发明 VoIP业务的 NAT组网应用系统结构示意图。 FIG. 1 is a schematic structural diagram of a NAT networking application system of a VoIP service according to the present invention.
图 2为本发明一实施例系统结构示意图。
图 3为图 2所示实施例的私网 PCC的登录流程。 实施本发明的方式 FIG. 2 is a schematic diagram of a system structure according to an embodiment of the present invention. FIG. 3 is a login flow of the private network PCC in the embodiment shown in FIG. 2. Mode of Carrying Out the Invention
下面结合附图对本发明进行详细描述。 The present invention is described in detail below with reference to the drawings.
本发明是在现有 VoIP系统上增加一地址代理服务器,把完成一次通 话需要在私网用户 PC客户端和 VoIP服务器之间建立的通道, 包括呼叫 信令通道和逻辑通道, 通过地址代理服务器在用户登录阶段就预先建 立,并且用每个通道在经过 NAT转换之后的公网地址及端口号代替原来 PCC的私网地址及端口号。 The present invention adds an address proxy server to the existing VoIP system. The channel that needs to be established between the PC client of the private network user and the VoIP server to complete a call includes call signaling channels and logical channels. The user login phase is established in advance, and the public network address and port number of each channel after NAT conversion are used to replace the original PCC private network address and port number.
参见图 1所示的 VoIP业务的 NAT组网应用系统结构示意图, 其中 VoIP业务服务器 10、 PC用户的 PC客户端和电话用户的网关(GW ) 11 均通过 IP网络连接, 该系统进一步包括一地址代理服务器 12, 亦通过 IP网络与系统连接。私网用户的 PC客户端 13通过 NAT路由器 14接入 公网。 Referring to the schematic diagram of the NAT networking application system structure of the VoIP service shown in FIG. 1, where the VoIP service server 10, the PC client's PC client, and the telephone user's gateway (GW) 11 are all connected through an IP network, the system further includes an address The proxy server 12 is also connected to the system through an IP network. The PC client 13 of the private network user accesses the public network through the NAT router 14.
当私网的 PC客户端向 VoIP服务器发出登录请求后, 向地址代理服 务器发起若干次 TCP或 UDP连接, 连接的次数等于私网 PCC与 VoIP 完成一次通话所需要建立的通道数。 这些连接按顺序编号为通道 1 When the PC client of the private network sends a login request to the VoIP server, it initiates several TCP or UDP connections to the address proxy server. The number of connections is equal to the number of channels that PCC and VoIP need to establish a call to complete. These connections are numbered sequentially as channel 1
( channel 1 )、 通道 2 ( channel 2 )、 、 通道 n ( channel n ), 它们的 源地址是私网 PCC的地址, 源端口号分别是所需通道的默认端口号,将 这几组地址 ( 包括 IP 地址和端口号) 称为 PrivateNetAddrl 、(channel 1), channel 2 (channel 2), channel n (channel n), their source address is the address of the private network PCC, and the source port numbers are the default port numbers of the required channels, and these groups of addresses ( Including IP address and port number) called PrivateNetAddrl,
PrivateNetAddr2 PrivateNetAddrn。 这些地址属于私网地址。 PrivateNetAddr2 PrivateNetAddrn. These addresses are private addresses.
通过 NAT转换后,这些连接报文到达地址代理服务器,此时源地址 经过地址 /端口转换, 已经转换为公网地址, 称为 PublicNetAddrl、 After the NAT conversion, these connection packets reach the address proxy server. At this time, the source address has been converted to a public network address through address / port conversion, which is called PublicNetAddrl,
PublicNetAddr2 PublicNetAddrn。 地址代理服务器将这些地址发 送给 VoIP服务器和私网内的 PC客户端, VoIP服务器将对应呼叫信令通
道的公网地址记录在该私网 PC客户端的地址域中,私网内的 PC客户端 将对应逻辑通道的公网地址记录在相应的地址域中。 PublicNetAddr2 PublicNetAddrn. The address proxy server sends these addresses to the VoIP server and the PC client in the private network. The VoIP server will communicate the corresponding call signaling. The public network address of the channel is recorded in the address field of the PC client of the private network, and the PC client in the private network records the public network address of the corresponding logical channel in the corresponding address field.
由于 NAT对于在其地址转换表中的地址转换记录采用了定时机制, 超过规定的时间没有更新连接, 就会将记录从表中删去。 所以需要设置 一个定时重发机制, 在规定的时间内 PrivateNetAddr 1、 2、 3没有接收 到报文, 就需要自动向地址代理服务器(AddProxy )重新发送 TCP 或 UDP连接。 Because NAT uses a timing mechanism for the address translation records in its address translation table, if the connection is not updated within the prescribed time, the record will be deleted from the table. Therefore, a regular retransmission mechanism needs to be set up. PrivateNetAddr 1, 2, 3 does not receive a message within a specified time, and it needs to automatically resend the TCP or UDP connection to the address proxy server (AddProxy).
对于 TCP连接, 在创建时具有开始 (SYN )标志, 没有 ACK标志 (除了这个报文之外所有的 TCP报文都有 ACK标志)。在中断时会有终 止( FIN )标志。 因此对于 TCP连接是依靠这些来判断 TCP连接的中断 和创建。 For a TCP connection, it has a start (SYN) flag when it is created, and no ACK flag (all TCP packets except this message have an ACK flag). There will be a FIN (FIN) flag during the interrupt. Therefore, for TCP connections, these are used to determine the interruption and creation of TCP connections.
对于 UDP报文,可以采用时间估计的方式。 当某个连接在若干时间 没有用时, 就认为这个连接已经中断了。 在一个新的连接发生时, 就认 为这个连接创建了。 这种用于估算连接的时间提供用户可以配置。 For UDP packets, time estimation can be used. When a connection is not used for a certain amount of time, it is considered that the connection has been broken. When a new connection occurs, the connection is considered to have been created. This time for estimating the connection is provided by the user and can be configured.
通过上述的步骤, 私网用户在上网登录时, 在呼叫建立之前就建立 了通话所需的通道, 并由定时重发机制一直预留。 呼叫发生时利用预留 的呼叫信令通道和逻辑通道进行通话。 用户下网后该预留通道自动拆 除。 Through the above steps, when a private network user logs on to the Internet, the channel required for the call is established before the call is established, and it is always reserved by the timing retransmission mechanism. When a call occurs, the reserved call signaling channel and logical channel are used for conversation. This reserved channel is automatically removed after the user goes offline.
私网的 PC用户作为主叫应用 VoIP业务时, 通过预留的呼叫信令通 道向所属的 VoIP服务器发起呼叫, 呼叫建立以后, 需要建立逻辑通道。 此时 PCC将自己的逻辑通道地址通过呼叫信令^^文地址发送给 VoIP服 务器,这时发出的逻辑通道地址是已经经过 NAT转换后的公网地址。建 立逻辑通道之后就可以顺利进行通话了。 When a PC user on a private network uses the VoIP service as a calling party, a call is initiated to the VoIP server to which the VoIP server belongs through a reserved call signaling channel. After the call is established, a logical channel needs to be established. At this time, the PCC sends its own logical channel address to the VoIP server through the call signaling address, and the logical channel address issued at this time is the public network address that has been NAT-translated. After the logical channel is established, the conversation can proceed smoothly.
私网的 PC用户作为被叫应用 VoIP业务时, 由公网的 PC用户通过 PCC或电话用户通过 GW发起呼叫, VoIP服务器收到呼叫信令消息,
查找到被叫的 IP地址, 此地址是经过 NAT转换后的公网地址, 将呼叫 信令报文发送到此地址对应的路由器,路由器查询 NAT地址转换表,找 到相对应的私网地址, 将呼叫信令转发到 PC客户端, 呼叫信令通道建 立。 私网用户的 PC客户端回送的呼叫信令 4艮文应包含逻辑通道地址, 此地址是经过 NAT转换后的公网地址。建立逻辑通道之后就可以顺利进 行通话了。 When a PC user in a private network uses the VoIP service as a called party, a PC user in a public network initiates a call through a PCC or a telephone user through a GW, and the VoIP server receives a call signaling message. Find the called IP address. This address is the public network address after NAT conversion. Send the call signaling packet to the router corresponding to this address. The router queries the NAT address translation table to find the corresponding private network address. The call signaling is forwarded to the PC client, and the call signaling channel is established. The call signaling returned by the PC client of the private network user should include the logical channel address, which is the public network address after NAT translation. After the logical channel is established, the conversation can proceed smoothly.
本发明技术方案可以应用于任何 IP语音业务。 以下结合图 2、 图 3 所示, 以个人号码业务(ONLY )为例, 进一步说明本发明内容及应用。 The technical solution of the present invention can be applied to any IP voice service. The content and application of the present invention will be further described below with reference to FIG. 2 and FIG. 3 and taking the personal number service (ONLY) as an example.
ONLY ( One Number Link You )业务是随着互联网的发展, 为满足 用户越来越迫切地希望随时随地相互交流和获取信息的需要, 在融合了 传统电信技术和 IP技术的基础上, 开发的一种创新性业务。 ONLY业务 主要是为使用者提供唯一的个人业务号码- - ONLY号码, 通过该号码 提供多种业务, 无论用户身处何地都可以更快捷地联络到指定用户, 被 联络的用户可以通过 PC、 电话、 语音信箱等多种方式接听呼叫。 The ONLY (One Number Link You) service is developed along with the development of the Internet. In order to meet the needs of users who are more and more eager to communicate and obtain information with each other anytime, anywhere, it is developed based on the integration of traditional telecommunications technology and IP technology. Kind of innovative business. ONLY business is mainly to provide users with a unique personal business number-ONLY number, through which a variety of services are provided, no matter where the user is located, he can more quickly contact the designated user, the contacted user can use the PC, Answer calls by phone, voice mail, etc.
ONLY系统由 ONLY业务服务器( ONLY Server )、 ONLY用户服务 器(User Server )、 PC客户端(PCC )、 交互式语音应答设备( IVR )、 数 据库、 Web服务器等构成, 其中 ONLY业务系统的 VoIP服务器功能是 由 ONLY Server和 User Server共同完成。 ONLY Server的主要功能有: 响应节点呼叫接入请求;与 User S erver叉互得到 ONLY号码的地址翻译; 与网守(GK )交互得到被叫电话号码的路由; 根据解析的目的地址中转 呼叫信令; 完成对网关 (MG ) 的控制功能; 与 IVR交互, 支持透传汉 音多频(DTMF )号码; 记录简单计费信息并向 User Server发送。 User Server的主要功能有: 呼叫策略选择(根据用户设置的呼叫策略将虛拟 ONLY号码翻译为真实电话号码或 PCC的 IP地址); PCC登录认证、呼 出授权、 状态维护; 语音信息 (VM )通告等。
和其他的 VoIP系统一样, ONLY业务在私网环境应用中也遇到了相 同的问题。参见图 2所示, 为采用本发明技术方案的 ONLY业务的 NAT 组网应用系统结构示意图。 其中除 ONLY系统原有的设备外, 新增加一 地址代理服务器 12, 通过 IP网络接入系统, 并对原有用户服务器和 PC 客户端做出相应的改动, 使 PCC在向 User Server登录后, 向地址代理 服务器发起 UDP连接, 地址代理服务器将其中的经过 NAT转换的公网 地址发送给 User Server, 并由 User Server在返回 PCC的登录请求响应 中将经过 NAT转换的公网地址传送给 PCC, User Server和 PCC分别记 录该等经过 NAT转换的公网地址, 为私网 PCC与 ONLY Server建立呼 叫预留需要的通道。 The ONLY system consists of the ONLY business server (ONLY Server), ONLY user server (User Server), PC client (PCC), interactive voice response device (IVR), database, Web server, etc., among which the VoIP server function of the ONLY business system It is completed by ONLY Server and User Server. The main functions of ONLY Server are: responding to the call access request of the node; obtaining the address translation of the ONLY number with the User Server fork; interacting with the gatekeeper (GK) to obtain the route of the called phone number; forwarding the call letter according to the resolved destination address Order; Complete the control function of the gateway (MG); Interact with the IVR, support the transparent transmission of Han tone multi-frequency (DTMF) numbers; Record simple billing information and send it to the User Server. User Server's main functions are: Call policy selection (translate virtual ONLY number to real phone number or PCC IP address according to the call policy set by the user); PCC login authentication, outgoing call authorization, status maintenance; voice message (VM) announcement, etc. . Like other VoIP systems, ONLY services have encountered the same problems in private network environment applications. Referring to FIG. 2, it is a schematic structural diagram of a NAT networking application system of an ONLY service adopting the technical solution of the present invention. In addition to the original equipment of the ONLY system, an address proxy server 12 is newly added to access the system through the IP network, and corresponding changes are made to the original user server and PC client, so that the PCC logs in to the User Server. Initiate a UDP connection to the address proxy server. The address proxy server sends the NAT-translated public network address to the User Server, and the User Server transmits the NAT-translated public network address to the PCC in the response to the PCC login request. User Server and PCC record these NAT-translated public network addresses, respectively, and reserve channels needed for the private network PCC and ONLY server to establish a call.
私网 PCC的登录流程参见图 3所示, 其中, 私网中 ONLY号码为 16655551234 的 PCC 13 向 User Server 102 发起登录请求消息 ( Login—Req )后, 需要向地址代理服务器 12发起三个 UDP连接。 将 这三个 UDP连接按顺序编号为 UDP1、 UDP2、 UDP3 , 它们的源地址是 私网 PCC 13的地址, UDP1、 2、 3的源端口号分别是 MGCP、 RTP、 RTCP 的默认端口号。 将这三组地址 (包括 IP 地址和端口号) 称为 PrivateNetAddrl、 PrivateNetAddr2、 PrivateNetAddr3。 这三组地址属于 私网地址。 The private network PCC login process is shown in Figure 3. Among them, the PCC 13 with the ONLY number of 16655551234 in the private network initiates a login request message (Login_Req) to the User Server 102, and needs to initiate three UDP connections to the address proxy server 12. . The three UDP connections are sequentially numbered as UDP1, UDP2, and UDP3. Their source addresses are the addresses of the private network PCC 13, and the source port numbers of UDP1, 2, and 3 are the default port numbers of MGCP, RTP, and RTCP. These three sets of addresses (including IP address and port number) are called PrivateNetAddrl, PrivateNetAddr2, PrivateNetAddr3. These three groups of addresses belong to private network addresses.
通过 NAT转换后, 上述三个 UDP报文到达地址代理服务器 12, 此 时源地址经过地址 /端口转换, 已经变为了公网地址, 将其称为 PublicNetAddrK PublicNetAddr2、 PublicNetAddr3。 地址代理服务器 12 将这三组公网地址发送给 User Server 102, User Server 102 将 PublicNetAddrl记录在 PCC 16655551234的地址域, 并在登录请求响应 消息( Login— Ack )中将 PublicNetAddr2和 PublicNetAddr3发送给 PCC, PCC记录这两个地址。
由于 NAT对于 UDP连接在地址转换表中的地址转换记录采用了定 时机制, 超过规定的时间没有更新连接, 就会将记录从表中删去。 所以 在没有通话发生的时候, PCC也必须与地址代理服务器 12保持 UDP1、 2、 3的连接, 所以需要设置一个特殊的定时重发机制, 在规定的时间内 PrivateNetAddrl、 2、 3 没有接收到报文, 就自动向地址代理服务器 12 重复发送 UDP报文。 After the NAT conversion, the above three UDP packets reach the address proxy server 12. At this time, the source address has been converted to a public network address through address / port conversion, which is called PublicNetAddrK PublicNetAddr2, PublicNetAddr3. The address proxy server 12 sends these three sets of public network addresses to User Server 102. User Server 102 records PublicNetAddrl in the address field of PCC 16655551234, and sends PublicNetAddr2 and PublicNetAddr3 to the PCC in a login request response message (Login—Ack). The PCC records these two addresses. Because NAT uses a timing mechanism for the address translation records in the address translation table for UDP connections, if the connection is not updated within the prescribed time, the records will be deleted from the table. Therefore, when no call occurs, the PCC must also maintain a UDP 1, 2, 3 connection with the address proxy server 12, so a special timer retransmission mechanism needs to be set up. PrivateNetAddrl, 2, 3 do not receive the report within the specified time. Send the UDP packet to the address proxy server 12 automatically and repeatedly.
经过上述的登录过程,通过地址代理服务器 12就预先建立起了私网 PCC与 ONLY Server之间呼叫需要建立的通道。 After the above login process, the address proxy server 12 has previously established a channel to be established between the private network PCC and the ONLY Server call.
当私网的 PCC 16655551234作为主叫, 发起呼叫的时候, 建立呼叫 信令通道, 由于在路由器的地址转换表中保持有呼叫信令通道的私网和 公网地址对应关系, 所以这个呼叫信令实际是使用了上述预留的通道。 PCC 13从源地址 PrivateNetAddrl发送 MGCP数据到 ONLY Server 101 , ONLY Server 101向 User Server 102查询呼叫控制策略, 向 GK查询被 叫网关或在 User Server得到被叫 ONLY号码所属 ONLY Server的地址, 开始建立逻辑通道。此时 PCC 16655551234将自己的 RTP和 RTCP地址 发送给被叫方,按照协议规定,应该是 PrivateNetAddr2、 PrivateNetAddr3。 但如果送出私网地址, 会造成对方的语音数据无法正确发送给 PCC 16655551234 , 所以应该将 PrivateNetAddr2、 PrivateNetAddr3 替换为 PublicNetAddr2、 PublicNetAddr3 ,这样就可以利用上述预留的逻辑通道, 使通话顺利进行。 When PCC 16655551234 of the private network is used as the calling party to initiate a call, a call signaling channel is established. Since the correspondence between the private network and the public network address of the call signaling channel is maintained in the address translation table of the router, this call signaling Actually, the above reserved channel is used. PCC 13 sends MGCP data from the source address PrivateNetAddrl to ONLY Server 101. ONLY Server 101 queries User Server 102 for the call control policy, queries the called gateway of the GK, or obtains the address of the ONLY Server to which the called ONLY number belongs from the User Server, and begins to establish logic. aisle. At this time, PCC 16655551234 sends its own RTP and RTCP addresses to the called party. According to the agreement, it should be PrivateNetAddr2, PrivateNetAddr3. However, if the private network address is sent, the other party's voice data cannot be sent to PCC 16655551234 correctly, so PrivateNetAddr2, PrivateNetAddr3 should be replaced with PublicNetAddr2, PublicNetAddr3, so that the reserved logical channel can be used to make the call proceed smoothly.
.当私网的 PCC 16655551234作为被叫, 由公网的 PC用户的 PCC或 电话用户的 GW发起呼叫的时候, ONLY Server 101接收到呼叫信令, 首先向 User Server 102 查询 PCC 16655551234 的地址, 查找到 PublicNetAddrl,将 MGCP数据发送到 PublicNetAddrl ,路由器查询 NAT 的地址转换表, 找到相对应的 PrivateNetAddrl , 将 MGCP数据发送到
PCC 16655551234。 当呼叫信令通道建立之后, PCC 16655551234回送 MGCP 的数据应包含 RTP 和 RTCP 地址, 按照协议规定, 应该是 PrivateNetAddr2、 PrivateNetAddr3。 但如果送出私网地址, 会造成主叫 方的语音数据无法正确发送给 PCC 16655551234 , 所以应该将 PrivateNetAddr2 、 PrivateNetAddr3 替 换 为 PublicNetAddr2 、 PublicNetAddr3 , 这样就利用了上述预留的逻辑通道进行语音数据的传 输。 When PCC 16655551234 of the private network is called and the call is initiated by the PCC of the PC user of the public network or the GW of the phone user, ONLY Server 101 receives the call signaling and first queries User Server 102 for the address of PCC 16655551234 and finds Go to PublicNetAddrl and send MGCP data to PublicNetAddrl. The router queries the NAT address translation table, finds the corresponding PrivateNetAddrl, and sends the MGCP data to PCC 16655551234. After the call signaling channel is established, the data returned by PCC 16655551234 to the MGCP should include the RTP and RTCP addresses. According to the protocol, it should be PrivateNetAddr2, PrivateNetAddr3. However, if the private network address is sent, the caller's voice data will not be sent to PCC 16655551234 correctly. Therefore, PrivateNetAddr2 and PrivateNetAddr3 should be replaced with PublicNetAddr2 and PublicNetAddr3. In this way, the reserved logical channels are used for voice data transmission.
本发明技术方案可应用于任何的 VoIP业务系统。 如为测试 IP电话 网关(Master、 Refmer、 Expert )的互通性, 用 H.323协议实现的一个在 PC上进行 IP电话的应用。 这个应用在私网环境下也遇到了与 ONLY业 务同样的问题。 将本发明技术方案引入到上述应用中, 所不同的是: 呼 叫信令使用 H.225协议,用 TCP建立通道。然后建立 H.245的控制通道, 最后建立一个逻辑通道。但呼叫建立的基本思想和 ONLY是有共同之处 的。 按照这个方案进行改进以后, 使其在私网环境下也能顺利通话, 通 过了基本功能验证和大呼叫量测试。 The technical solution of the present invention can be applied to any VoIP service system. For example, to test the interoperability of the IP phone gateway (Master, Refmer, Expert), an H.323 protocol is used to implement an IP phone application on a PC. This application also encountered the same problems in the private network environment as the ONLY business. The technical solution of the present invention is introduced into the above application with the following differences: The call signaling uses the H.225 protocol and the TCP is used to establish a channel. Then establish the H.245 control channel, and finally establish a logical channel. But the basic idea of call establishment and ONLY have something in common. After improving according to this scheme, it can make a smooth call even in the private network environment, and passed the basic function verification and large call volume test.
综上所述, 本发明方案简便易行, 具有很好的实用性和可靠性。
In summary, the solution of the present invention is simple and easy to implement, and has good practicability and reliability.