"In recent years, with the increasing development of broadband network and IP technology, VoIP (voice over Internet Protoc01) technology is more and more widely used. Gateway is an important device in VoIP network. It can be divided into carrier gateway and client gateway according to the application field. Client gateway equipment is mainly used in communities and enterprises. It is a bridge connecting terminal telephone and IP network. Its main functions are voice encoding and decoding, signaling processing, VoIP protocol processing and routing protocol processing. The location of the client gateway device in the VoIP network is shown in Figure 1. It can be seen that the gateway is at the end of the user telephone line and the beginning of the IP network.
"Dual mode" refers to VoIP and PSTN modes. Dual mode gateway is a client gateway device that connects PSTN network and VoIP network at the same time and can automatically switch between them. The dual-mode gateway can use the VoIP network to save a lot of communication costs. It can also use the PSTN network when the VoIP network is unavailable (power failure or route inaccessible) to ensure that the telephone line is always unblocked. Moreover, using the dual-mode gateway does not need to make any changes to the PBX switch. Users can also freely choose or automatically choose whether to use the VoIP network or the PSTN network by the gateway, It has good practicability and flexibility.
1. Working principle of VoIP dual-mode gateway
Gateway mainly plays the role of protocol conversion, control and gatekeeping in VoIP network, such as call control and call management. Dual mode gateway adds switching between VoIP and PSTN on the basis of ordinary VoIP gateway. The dual-mode gateway system can be functionally divided into dual-mode switching module, FXS interface circuit module, voice processing module and software control module. The system block diagram is shown in Figure 2.
FXS (fbreign exchange subsystem) interface and FXO (foreign exchange office) interface are two very important interfaces in VoIP gateway. In the traditional PSTN telephone connection, the telephone Center office end switch provides feed and ring flow, and the telephone itself completes the tip / ring circuit to request service or answer calls on the PSTN. In VoIP telephone connection, FXS circuit simulates the function of telephone Center office end switch, provides feed and bell current, and detects loop current. FXO circuit is equivalent to simulating the function of telephone, providing loop closure and detecting bell flow.
The FXS interface circuit is directly connected with the analog telephone to provide dial tone, feed and bell current voltage, and can detect the off hook and loop closure of the telephone to complete the mutual conversion between analog signals and digital signals. FXS interface circuit includes codec and subscriber line interface circuit (SLIC). Codec includes an analog-to-digital converter (ADC) and a digital to analog converter (DAC). The SLIC circuit simulates the PSTN voltage. It must be able to detect the pick-up and hang-up of the telephone and produce a bell current voltage up to 120V.
The dual-mode switching module mainly includes FXO interface circuit, which is composed of codec and data access array (DAA). Codec is the same as that in FXS circuit; DAA simulates a telephone, removes the high-voltage DC component by providing the loop closure of PSTN, and only allows the analog AC signal on PSTN line to pass through. The following functions can be realized by using FXO interface circuit in the gateway:
(1) Keep the line unblocked in case of power failure: when the gateway is powered off and cannot connect to the VoIP network, switch the line to the PSTN line.
(2) Call redirection: when the VoIP network is unavailable due to congestion or other reasons, it can switch the line to PSTN, remember the dialed number and redial automatically.
(3) Remote VoIP call: VoIP users can make VoIP calls in other places by dialing in through PSTN. FXO interface first receives the telephone dial tone (analog signal) on PSTN, and then converts it into digital signal and sends it out, which is equivalent to expanding the dial tone from one FXO to multiple local FXS.
The voice processing module of the gateway is responsible for compressing and decompressing the PCM digital voice signal. The standards of compression algorithms include G.711, G.723.1 and G.729. Different algorithms have different compression ratios and occupy different bandwidth. The compression algorithm can be realized by hardware DSP or pure software.
The software control module realizes the functions of protocol stack processing and routing processing of the gateway. The protocol stack is responsible for encapsulating the compressed data stream and adding the IP protocol packet header to form an IP packet that can be transmitted in the VoIP network. At present, VoIP protocol stack is mainly based on H.323 and sip standards. After the protocol stack turns the data stream into IP packets, it selects the appropriate route and sends it to the voif network through the Ethernet interface. After receiving the IP packet, the gateway at the receiving end decompresses the packet and decodes the decompressed PCM digital signal to recover the original voice signal.
2. Design of VoIP dual-mode gateway system
This section presents a system design scheme of dual-mode gateway based on H.323. The scheme supports 4-way voice, and realizes dual-mode switching by using an economical and practical "false FXO interface". It can detect the incoming call on PSTN line during VoIP call, and can switch and answer by pressing the beat spring or flash key of the phone.
In order to make effective use of resources, the system uses a three-phase adapter to combine the telephone line and PSTN line to an RJ11 interface, and each session uses a three-phase adapter. The connection mode of three-phase adapter is shown in Figure 3.
The use of three-phase adapter can simplify the realization of dual-mode switching and reduce the number of physical ports of the equipment.
The system design adopts the overall architecture of "hardware + embedded operating system + application layer software".
2.1 hardware design scheme
The hardware part of the system mainly includes dual-mode switching module, FXS interface circuit, voice processing module circuit, CPU module and Ethernet module. The hardware design schematic diagram is shown in Figure 4.
The dual-mode switching module uses a "false FXO interface" mode. In the circuit, a relay is used to control the dual-mode switching between VoIP and PSTN channels of each session. When the gateway is not powered on, the relay will set the gateway to the state of connecting the telephone line with the PSTN line by default. After power on, one FPGA programmable logic chip will control the switching of the relay. FPGA chip is the key component of the gateway to realize intelligent switching. The control logic includes bell flow detection on PSTN line, telephone beat spring action detection and other logic, and controls the relay to switch accordingly. The interface between FPGA and CPU can realize the logic of switching to PSTN network when the VoIP network route is unreachable. Dual mode switching module realizes some functions of FXO interface, but it is not a real FXO interface, so it is called "false FXO interface".
FXS interface circuit module is mainly composed of suc chip and codee chip, and le79r70 chip and le58q021 chip of legerity company are selected respectively. Le58q021 is a 4-channel codec chip, which can control the working state of SLIC chip (le79r70) and select the coding scheme (linear, A-Law μ It also supports the input impedance, balance impedance and frequency response characteristics of software programmable SLIC. The system uses one le58q021 and four le79r70 to work together, supports four channels of voice, provides feed to the phone, generates ringing signal, detects phone off hook, etc., and is responsible for completing the mutual conversion of telephone analog signal and PCM digital signal.
Ac483 of audiocodes company is selected as the DSP chip for speech processing. It can support 4-channel speech codec at the same time, G.729A, G.723.1, G.727, G.726, G.711 and other compression algorithm standards, and can complete real-time speech compression, DTMF signal detection, generation and echo cancellation.
S3C4510B of ARM7TDMI series of SamSung company is selected as the system CPU chip. Its working frequency is 50nhz. A wealth of general modules are integrated in the chip, including 10m / 100M adaptive Ethernet controller, which can directly lead out the Ethernet interface through PHY chip. Lxt972a chip of Intel company is selected as Ethernet PHY chip, which has 1om / 100M adaptive transceiver function and supports full duplex operation. In addition, the system also uses 2MB flash, 16MB SDRAM and 512KB SRAM as memory.
2.2 software design scheme
The software part is mainly composed of embedded operating system and application layer software to complete protocol stack processing, routing processing and other control functions. The hierarchical structure of the software scheme is shown in Figure 5.
Embedded operating system adopts μ CLinux。 μ Clinux is an embedded operating system customized for processors without memory management unit. It has the characteristics of rich network functions, open source code, tailorable inner edges and easy transplantation. According to the characteristics of the hardware platform, it is also necessary to develop drivers suitable for the hardware platform, including bootloader, serial driver and Ethernet driver. Bootloader is the key to transplant uClinux operating system. When the system is powered on, bootloader is responsible for hardware initialization, interrupt processing and hardware clock management, and loads the operating system image into memory. In order to facilitate system network upgrade, bootloader can realize TFTP network function. The serial port and Ethernet port drivers are relatively simple to realize the correct sending and receiving of data.
The software of the application layer is mainly composed of H.323 protocol stack processing module, routing processing module and DSP control module. H. 323 protocol stack is responsible for call control and signaling, audio processing and media real-time transmission. The system uses the relatively mature open source OpenH323 protocol stack as a reference, and the functional modules on the application layer are developed based on the protocol stack. The routing addressing module is mainly responsible for routing addressing and routing management, determining the IP address of the destination gateway, selecting the best route, and transmitting IP packets to the destination gateway through the IP network. The DSP control module mainly compiles the corresponding control program according to the call flow in the application program to control the behavior of DSP chip ac483. The network management module provides Web network management and cli command line interface, which is easy to configure and maintain the dual-mode gateway.
3 application scheme
As a client gateway device, the system can be widely used in communities and enterprises. For a cell with a small number of users, the telephone can be directly connected to the gateway, as shown in Figure 6. Enterprises with a relatively large number of users can be connected to PBX switches, as shown in Figure 7.
The system is designed based on H.323 protocol stack. At present, the basic functions of the system have been realized, which can communicate with other gateway equipment and with the gatekeeper of the operator. On the basis of this design, more sessions can be supported by selecting chips with stronger processing power, SIP protocol stack can be added to support dual protocol stack architecture, and real FXO interface circuit can be realized to support remote VoIP calls. These are the places where the system can be improved in the future.
Responsible editor: GT, read the full text“
Our other product: