Abstract:
A communication system for using the session initiation protocol (SIP) in a network address translation (NAT) environment is provided, which includes a client, a relay server and a SIP server. The relay server is connected to the SIP server and connected to the client through a NAT server. The relay server is configured to establish connection with the client and register with the SIP server so as to allow direct communication between the client and the SIP server, thereby conducting authentication and management of the client and further solving the conventional problem of incompatibility between the SIP server and the client.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    The present invention relates generally to communication systems and methods for using session initiation protocol (SIP), and, more particularly, to a communication system and method for using SIP in a network address translation (NAT) environment. 
         [0003]    2. Description of Related Art 
         [0004]    Conventionally, voice communications are accomplished via the public switched telephone network (PSTN) provided by telecom companies. The PSTN is a network used for voice communications worldwide and has several hundreds of millions of users. Along with the development of the Internet, voice communications are also implemented over Internet by using solutions such as the voice over Internet protocol (VoIP). VoIP converts analog voice signals from a sending end into digital signals and then transmits the digital signals to a receiving end that further converts the digital signals back into analog voice signals, thereby achieving voice communication over the Internet. Therein, the session initiation protocol (SIP) is one of the most commonly used communication protocols. In addition, an IP PBX supports direct communication of digital signals over the Internet. 
         [0005]    Generally, not every computer of an enterprise has or needs a real network address. Accordingly, a network address translation (NAT) technology is required, which enables the enterprise to use virtual network addresses for internal data transmission and communication and translate virtual network addresses and ports to real network addresses and ports through a NAT server for external traffic. 
         [0006]    However, some IP PBXs of enterprises may be incompatible with the SIP servers of telecom companies. As such, the IP PBXs cannot register with the SIP servers, or the SIP servers cannot set up SIP trunks to the IP PBXs, thereby preventing direct communication with the IP PBXs. In such a case, it is necessary to use a VoIP gateway that is compatible with the SIP server being used, which, however, can easily lead to poor voice quality and has the potential risk of becoming an obstacle blocking communication. In addition, although some IP PBXs can communicate with SIP servers, the communication is based on trust between the IP PBXs and the SIP servers, thereby making it impossible to authenticate and manage specific IP PBXs. Further, there exist some problems for a VoIP in a NAT environment. For example, when the VoIP registers with a SIP server through a VoIP gateway, since the NAT server translates a virtual network address in an enterprise into a real network address, the SIP server cannot transmit a registration result to the original VoIP gateway, thus adversely affecting registration, authentication and management of the specific VoIP. 
         [0007]    Therefore, in a conventional communication system, due to incompatibility between a client, such as an IP PBX or a VoIP gateway, and a SIP server of a limited NAT environment, the client cannot register with the SIP server or the SIP server cannot provide authentication and management mechanisms to the client. Therefore, it is imperative to provide a communication method and system so as to overcome the above-described drawbacks. 
       SUMMARY OF THE INVENTION 
       [0008]    Accordingly, the present invention provides a communication system and method for using SIP in a NAT environment so as to overcome the conventional drawback of incompatibility between a SIP server and a client and meanwhile provide authentication and management mechanisms to the client. 
         [0009]    According to an aspect of the present invention, a communication method for using SIP in a NAT environment comprises the steps of: establishing a connection between a relay server and a client; registering the relay server with a SIP server; having the client use the SIP to transmit a communication request through a NAT server and the relay server to the SIP server; and, after checking the content of a SIP packet containing the communication request and received by the SIP server, having the SIP server determine whether to permit the communication request and transmitting the determination result through the relay server to the client. 
         [0010]    The present invention further provides a communication system for using SIP in a NAT environment, which comprises: a client built on the Internet; a relay server built on the Internet and connected with the client through a NAT server; and a SIP server built on the Internet and connected with the relay server, wherein the SIP server is configured to establish a connection with the client, the relay server is configured to register with the SIP server, the client is configured to use the SIP to transmit a communication request through the NAT server and the relay server to the SIP server, and the SIP server is configured to check the content of a SIP packet containing the communication request and received by the SIP server, so as to determine whether to permit the communication request and transmit the determination result through the relay server to the client. 
         [0011]    Compared with the prior art, the present invention uses a relay server to establish connection with a client and further enable the relay server to register with a SIP server so as to allow direct communication between the client and the SIP server, thereby overcoming the conventional drawback of incompatibility between a SIP server and a client and meanwhile providing authentication and management mechanisms to the client. 
     
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
         [0012]      FIG. 1  is a block diagram showing the structure of a communication system for using SIP in a NAT environment according to a first embodiment of the present invention; 
           [0013]      FIG. 2  is a flow diagram showing a communication method for using SIP in a NAT environment according to the first embodiment of the present invention; 
           [0014]      FIG. 3  is a block diagram showing the structure of a communication system for using SIP in a NAT environment according to a second embodiment of the present invention; and 
           [0015]      FIG. 4  is a flow diagram showing a communication method for using SIP in a NAT environment according to the second embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
       [0016]    The following illustrative embodiments are provided to illustrate the disclosure of the present invention and its advantages, these and other advantages and effects being apparent to those in the art after reading this specification. 
       First Embodiment 
       [0017]      FIG. 1  shows the structure of a communication system  100  for using SIP in a NAT environment according to a first embodiment of the present invention. 
         [0018]    Referring to  FIG. 1 , the communication system  100  is established on the Internet and has: an IP PBX  110 , a NAT server  120 , a relay server  130  and a SIP server  140 . Therein, the SIP server  140  is, but is not limited to, a multimedia communication server. The relay server  130  has a record table  135  for recording communication data, such as communication times, between the SIP server  140  and the IP PBX  110 . The NAT server  120  has a routing table  125  for recording addresses and ports before translation by the NAT server and addresses and ports after translation by the NAT server. The present embodiment shows two IP PBXs, but it is not limited thereto. 
         [0019]    In the communication system  100 , the IP PBX  110  is connected with the NAT server  120  such that the NAT server  120  translates input virtual addresses and ports into real addresses and ports and stores the virtual and real addresses and ports in the routing table  125 . The relay server  130  is connected with the IP PBX  110  through the NAT server  120 . The SIP server  140  is connected with the relay server  130 . 
         [0020]    The communication system  100  further has a lightweight directory access protocol (LDAP) server  150 , which is connected with the relay server  130  for managing accounts and passwords. 
         [0021]    The communication system  100  further has a called number end  160 , which is connected with SIP server  140  for transmitting communication packets. 
         [0022]      FIG. 2  shows the flow process of a communication method  200  for using SIP in a NAT environment according to the first embodiment of the present invention. 
         [0023]    Referring to  FIG. 2 , at step S 210 , an IP PBX  110 , a relay server  130  and a SIP server  140  are provided on the Internet, wherein the relay server  130  is connected with the SIP server  140  and further connected with the IP PBX  110  through a NAT server  120 . Then, the process goes to step S 220 . 
         [0024]    At step S 220 , the relay server  130  sets up a trunk to the IP PBX  110  and registers with the SIP server  140 , wherein the SIP server  140  checks the account and/or password so as to determine whether to permit registration of the relay server  130  and transmits the determination result to the relay server  130 . If the relay server  130  is permitted to register, a positive determination result granting permission is transmitted to the relay server  130  and the process goes to step S 221 , otherwise, a negative determination result indicating rejection is transmitted to the relay server  130  and the process is ended. 
         [0025]    At step S 221 , the relay server  130  listens to determine whether a communication request is transmitted to the relay server  130 , wherein, if one is transmitted, the process goes to step S 230 , and, otherwise, the relay server  130  continues to listen. 
         [0026]    At step S 230 , when the IP PBX  110  uses SIP to transmit a communication request through the NAT server  120  to the relay server  130 , the relay server  130  transmits the communication request to the SIP server  140 . Therein, the relay server  130  changes the content of the SIP packet containing the communication request. Preferably, the header source of the SIP packet is changed from its address and port before translation by the NAT server  120  to the address and port of the relay server  130 . Then, the process goes to step S 240 . 
         [0027]    At step S 240 , the SIP server  140  checks the SIP packet, which involves checking the address and port, account, SIP domain, called number and/or maximum number of calls at the same time. Then, the process goes to step S 250 . 
         [0028]    At step S 250 , according to the checking result, the SIP server  140  determines whether to permit the communication request, and, after verifying that the communication condition of the called number end  160  is normal, the SIP server  140  transmits the determination result through the relay server  130  to the IP PBX  110 . Therein, when the SIP server  140  uses SIP to transmit the determination result through the relay server  130  to the IP PBX  110 , the relay server  130  changes the content of the SIP packet. Preferably, the header source of the SIP packet is changed from the address and port of the SIP server  140  to the address and port before translation by the NAT server  120 . If the communication request is permitted, then the process goes to step S 260 , and, otherwise, the process goes to step S 251 . 
         [0029]    At step S 251 , the SIP server  140  transmits the determination result of rejection to the IP PBX  110  through the relay server  130  and ends the communication request. Then, the process goes to step S 221 . In other embodiments, after the communication request is ended, the process can be selectively ended. 
         [0030]    At step S 260 , the SIP server  140  transmits the positive determination result granting permission to the IP PBX  110  through the relay server  130 , and the relay server  130  establishes a communication path with the IP PBX  110  and chooses to use an account corresponding to the SIP server  140  so as to establish a communication path with the SIP server  140 , thereby transmitting communication packets to the called number end  160 . The relay server  130  records communication data such as the time of establishing of the communication paths so as to authenticate and manage the IP PBX  110 . Then, the process goes to step S 270 . 
         [0031]    At step S 270 , when the IP PBX  110  transmits a communication packet to the relay server  130 , the relay server  130  records the real-time transfer protocol (RTP) address and port used by the IP PBX  110 . Subsequently, the relay server  130  sends a re-invite request to the IP PBX  110  and changes the RTP address and port used by the IP PBX  110  so as to allow direct communication between the IP PBX  110  and the SIP server  140 . When the SIP server  140  transmits a communication packet to the relay server  130 , the relay server  130  records the RTP address and port used by the SIP server  140 . Additionally, the relay server  130  sends a re-invite request to the SIP server  140  and changes the RTP address and port used by the SIP server  140  so as to allow direct communication between the IP PBX  110  and the SIP server  140 . Then, the process goes to step S 280 . 
         [0032]    At step S 280 , in order to end communication with the SIP server  140 , the IP PBX  110  transmits a communication-ending request to the relay server  130  and the relay server  130  records communication data such as the time of closing of the communication paths so as to authenticate and mange the IP PBX  110 . Then, the process goes to step S 290 . 
         [0033]    At step S 290 , the relay server  130  transmits the communication-ending request to the SIP server  140  and closes the communication paths and processes the communication data related to the establishing and closing of the communication paths so as to authenticate and mange the IP PBX  110 . For example, based on the time of establishing of the communication paths and the time of closing the communication paths, the relay server  130  can calculate communication expenses, but it is not limited thereto. 
       Second Embodiment 
       [0034]      FIG. 3  shows the structure of a communication system  300  for using SIP in a NAT environment according to a second embodiment of the present invention. The main difference of the present embodiment from the first embodiment is that the present embodiment uses a VoIP device and a VoIP gateway instead of the IP PBX of the first embodiment. Since the application environment and steps of the present embodiment are the same as those of the first embodiment, detailed description thereof is omitted herein. 
         [0035]    Referring to  FIG. 3 , the communication system  300  is interconnected with the Internet and comprises: a VoIP device  310 , a VoIP gateway  315 , a NAT server  320 , a relay server  330  and a SIP server  340 . Therein, the VoIP device  310  is connected with the VoIP gateway  315 , and the VoIP gateway  315  is connected with the NAT server  320 . The NAT server  320  translates input virtual addresses and ports into real addresses and ports and stores the virtual and real addresses and ports in a routing table  325 . The relay server  330  is connected with the VoIP gateway  315  through the NAT server  320 , and the relay server  330  has a record table  335 . The SIP server  340  is connected with the relay server  330 . Although  FIG. 3  shows a plurality of VoIP devices and VoIP gateways, it should be noted that the number of VoIP devices and the number of VoIP gateways shown in the drawing are only for illustrative purposes and not intended to limit the present invention. 
         [0036]    The communication system  300  further has an LDAP server  350 , which is connected with the relay server  330  for managing accounts and passwords. 
         [0037]    The communication system  300  further has a called number end  360 , which is connected with SIP server  340  for transmitting communication packets. 
         [0038]      FIG. 4  shows the flow process of a communication method  400  for using SIP in a NAT environment according to the second embodiment of the present invention. 
         [0039]    Referring to  FIG. 4 , at step S 410 , a VoIP device  310 , a VoIP gateway  315 , a relay server  330  and a SIP server  340  are provided on the Internet. Therein, the VoIP device  310  is connected with the VoIP gateway  315 , and the relay server  330  is connected with the SIP server  340  and further connected with the VoIP gateway  315  through a NAT server  320 . Then, the process goes to step S 420 . 
         [0040]    At step S 420 , the VoIP gateway  315  registers with the relay server  330  and the relay server  330  registers with the SIP server  340 , wherein the SIP server  340  checks account and/or password data so as to determine whether to permit registration of the relay server  330  and transmits the determination result to the relay server  330 . If the relay server  330  is permitted to register, a positive determination result granting permission is transmitted to the relay server  330  and the process goes to step S 421 , otherwise, a negative determination result indicating rejection is transmitted to the relay server  330  and the process is ended. 
         [0041]    At step S 421 , the relay server  330  listens to determine whether a communication request is transmitted to the relay server  330 , wherein, if one is transmitted, the process goes to step S 430 , and, otherwise, the relay server  330  continues to listen. 
         [0042]    At step S 430 , when the VoIP gateway  315  uses SIP to transmit a communication request through the NAT server  320  to the relay server  330 , the relay server  330  transmits the communication request to the SIP server  340 . Therein, the relay server  330  changes the content of the SIP packet. Preferably, the header source of the SIP packet is changed from the address and port before translation by the NAT server  320  to the address and port of the relay server  330 . Then, the process goes to step S 440 . 
         [0043]    At step S 440 , the SIP server  340  checks the SIP packet, which involves checking the address and port, account, SIP domain, called number and/or maximum number of calls at the same time. Then, the process goes to step S 450 . 
         [0044]    At step S 450 , according to the checking result, the SIP server  340  determines whether to permit the communication request, and, after verifying that the communication condition of the called number end  360  is normal, the SIP server  340  transmits the determination result through the relay server  330  to the VoIP gateway  315 . Therein, when the SIP server  340  uses SIP to transmit the determination result through the relay server  330  to the VoIP gateway  315 , the relay server  330  changes the content of the SIP packet. Preferably, the header source of the SIP packet is changed from the address and port of the SIP server  340  to the address and port before translation by the NAT server  320 . If the communication request is permitted, the process goes to step S 460 , and, otherwise, the process goes to step S 451 . 
         [0045]    At step S 451 , the SIP server  340  transmits a negative determination result indicating rejection to the VoIP gateway  315  through the relay server  330  and ends the communication request. Then, the process goes to step S 421 . In other embodiments, after the communication request is ended, the process can be selectively ended. 
         [0046]    At step S 460 , the SIP server  340  transmits the positive determination result granting permission to the VoIP gateway  315  through the relay server  330 , and the relay server  330  establishes a communication path with the VoIP gateway  315  and chooses to use an account corresponding to the SIP server  340  so as to establish a communication path with the SIP server  340 , thereby transmitting communication packets to the called number end  360 . The relay server  330  records communication data such as the time of establishing of the communication paths so as to authenticate and manage the VoIP gateway  315 . Then, the process goes to step S 470 . 
         [0047]    At step S 470 , when the VoIP gateway  315  transmits a communication packet to the relay server  330 , the relay server  330  records the RTP address and port used by the VoIP gateway  315 . Additionally, the relay server  330  sends a re-invite request to the VoIP gateway  315  and changes the RTP address and port used by the VoIP gateway  315  so as to allow direct communication between the VoIP gateway  315  and the SIP server  340 . When the SIP server  340  transmits a communication packet to the relay server  330 , the relay server  330  records RTP address and port used by the SIP server  340 . Moreover, the relay server  330  sends a re-invite request to the SIP server  340  and changes the RTP address and port used by the SIP server  340  so as to allow direct communication between the VoIP gateway  315  and the SIP server  340 . Then, the process goes to step S 480 . 
         [0048]    At step S 480 , in order to end communication with the SIP server  340 , the VoIP gateway  315  transmits a communication-ending request to the relay server  330  and the relay server  330  records communication data, such as the time of closing of the communication paths, so as to authenticate and mange the VoIP gateway  315 . Then, the process goes to step S 490 . 
         [0049]    At step S 490 , the relay server  330  transmits the communication-ending request to the SIP server  340  and close the communication paths and process the communication data related to the establishing and closing of the communication paths so as to authenticate and mange the VoIP gateway  315 . For example, based on the time of establishing of the communication paths and the time of closing the communication paths, the relay server  330  can calculate communication expenses, but it is not limited thereto. 
         [0050]    For example, at step S 410 , suppose that the address of the VoIP gateway  315  is 192.168.1.1, the address of the NAT server  320  is 10.254.254.1, the address of the relay server  330  is 61.219.12.36 and the address of the SIP server  340  is 203.66.96.148. Next, the process goes to step S 420 , as described previously. 
         [0051]    At step S 420 , the VoIP gateway  315  registers with the relay server  330  and the relay server  330  registers with the SIP server  340 . Then, the process goes to step S 421 . 
         [0052]    At step S 421 , when the relay server  430  receives a communication request from the VoIP gateway  315  using SIP, the process goes to step S 430 . 
         [0053]    At step S 430 , the relay server  330  changes the header source of the SIP packet from the address and port before translation by the NAT server  320  to the address and port of the relay server  330 . That is, the head source of the SIP packet is changed from 192.168.1.1:12345 to 61.219.12.36:54321. Then, the process goes to step S 440 . 
         [0054]    At step S 440 , the SIP server  340  checks the SIP packet of the SIP. Then, the process goes to step S 450 . 
         [0055]    At step S 450 , the relay server  330  changes the header source of the SIP packet from the address and port of the SIP server  340  to the address and port before translation by the NAT server  320 . That is, the header source of the SIP packet is changed from 203.66.96.148:54321 to 192.168.1.1:12345. Then, the process goes to step S 460 . 
         [0056]    At step S 460 , the SIP server  340  transmits the positive determination result granting permission to the VoIP gateway  315  through the relay server  330 . Then, the process goes to step S 470 . 
         [0057]    At step S 470 , the relay server  330  changes the RTP address and port used by the VoIP gateway  315  and the RTP address and port used by the SIP server  340  so as to allow direct communication between the VoIP gateway  315  and the SIP server  340 . That is, the RTP address and port used by the VoIP gateway  315  is changed from 61.219.12.36:54321 to 203.66.96.148:54321 and the RTP address and port used by the SIP server  340  is changed from 61.219.12.36:54321 to 10.254.254.1:54321. Then, the process goes to step S 480 . 
         [0058]    At step S 480 , in order to end communication with the SIP server  340 , the VoIP gateway  315  transmits a communication-ending request to the relay server  330 . Then, the process goes to step S 490 . 
         [0059]    At step S 490 , the relay server  330  transmits the communication-ending request to the SIP server  340  and closes the communication paths. 
         [0060]    In the above-described embodiment, the IP PBX and the VoIP gateway can be referred to as clients, and the relay server setting up a trunk to the IP PBX and the VoIP gateway registering with the relay server can be referred to as establishing a connection between the relay server and the clients. 
         [0061]    The above-described descriptions of the detailed embodiments are provided to illustrate the preferred implementation according to the present invention, and are not intended to limit the scope of the present invention. Accordingly, many modifications and variations completed by those with ordinary skill in the art can be made and yet still fall within the scope of the present invention as defined by the appended claims.