A kind of voice for home gateway carry domain name analytic method
Technical field
The present invention relates to voice and carry domain name mapping technology, be specifically related to a kind of voice for home gateway and carry domain name analytic method.
Background technology
Domain name mapping is that domain name is pointed to web space IP, allows people can have access to easily a kind of service in website by the domain name of registration.Domain name sensing, Servers installed, domain name configuration and oppositely IP registration etc. are also named in domain name mapping.Say to such an extent that simply exactly domain name mapping easy to remember is become to IP, service is completed by dns server, is domain name mapping to IP address, then on the main frame of this IP address, a subdirectory and domain name is bound.
VoIP(Voice over Internet Protocol) be exactly by analog signal (Voice) digitlization in brief, with the form of data packet (Data Packet), in IP network (IP Network), do real-time transmission.The advantage of VoIP maximum is the environment that can adopt widely Internet and global ip interconnection, and, better service more than traditional business is provided.VoIP can be cheap in IP network the business such as transmission voice, fax, video and data, as storage forwarding of unified message business, virtual telephony, virtual speech/fax mailbox, directory enquiry service, Internet call center, Internet call manager, video conference, ecommerce, fax storage forwarding and various information etc.The basic principle of VoIP is: the compression algorithm by voice is compressed processing to encoded speech data, then these speech datas are packed by TCP/IP standard, through IP network, packet is delivered to and received ground, again these VoPs are stringed together, after decompression processing, revert to original voice signal, thereby reach the object that is transmitted voice by the Internet.The core of IP phone and key equipment are IP gateways, and it is mapped as corresponding regional gateway ip address each department area code.These information leave in a database, and the data process software that continues will complete the functions such as call treatment, digital speech packing, routing management.When user dials toll telephone, gateway, according to area code database data, is determined the IP address of respective gateway, and this IP address is added in IP packet, select best route, to reduce propagation delay time, IP packet arrives the gateway of destination through Internet simultaneously.The area that not yet extends to or temporarily do not set up gateway at some Internet, can arrange route, by nearest gateway, by long-distance network, is transferred, and realizes communication service.
And voice registrar, proxy server and out proxy server may be filled in, be domain name, just need to carry out domain name mapping this time.
Existing technical disadvantages is: when registrar, proxy server, out proxy server are domain name, voice process need to be to domain name system (Domain Name System, DNS) process transmission asynchronous message is resolved, after resolving, DNS process sends message again and obtains real ip address to voice process, ductility while causing, under efficiency.
Summary of the invention
The invention provides a kind of voice for home gateway and carry domain name analytic method, under voice process, create thread, by thread, resolve, efficiency is high, real-time, and more accurate.
For achieving the above object, the invention provides a kind of voice for home gateway and carry domain name analytic method, be characterized in, the method includes the steps of:
Under step 1, voice process, create the array for the ip address of storing queries domain name and correspondence, this array initialization is put to sky;
Step 2, voice process creation domain name system thread, for the treatment of the request analysis of domain name system under voice process;
Step 3, query State mechanism, status mechanism comprises: inquiry is idle, in inquiry, successful inquiring and inquiry failure; After initialization, status mechanism is the inquiry free time;
Judge the status mechanism of current domain name system queries, if inquire about the free time, jump to step 4, if return in inquiry;
Step 4, the domain name that will inquire about are imported into, and the domain name in the domain name system of the domain name transmitting and voice process is compared, and judge whether domain name system has this domain name of importing into, if jump to step 5, jump to if not step 6;
Step 5, carry out domain name mapping and obtain corresponding IP address, and array corresponding to this domain name and corresponding IP address thereof import into, change status mechanism into successful inquiring, jump to step 7;
Step 6, status mechanism be for to inquire about unsuccessfully, and jump to step 4 and again inquire about;
Step 7, the database that the domain name of successful inquiring and corresponding IP address thereof are joined to the domain name system of voice process store.
When above-mentioned steps 4 is inquired about, to storing the file of domain name and IP address corresponding relation, lock; And in step 6, complete when inquiry and carry out release.
Compared to the prior art a kind of voice for home gateway of the present invention carry domain name analytic method, its advantage is, the present invention resolves domain name addresses by creating a thread by thread, effectively reduce the waste of resource, and can obtain fast the true address of required domain name mapping, and retain this address, efficiency is high, real-time, accuracy is high.
Accompanying drawing explanation
Fig. 1 is the flow chart that a kind of voice for home gateway of the present invention carry domain name analytic method.
Embodiment
Below in conjunction with accompanying drawing, further illustrate specific embodiments of the invention.
As shown in Figure 1, the present invention discloses a kind of voice for home gateway and carries domain name analytic method, and the method includes the steps of:
Step 1, voice process (voice) be lower creates the array for storing queries domain name and corresponding IP address, this array is carried out to initialization and put sky.
Step 2, voice process creation domain name system thread, for the treatment of the request analysis of domain name system under voice process.
Step 3, query State mechanism, status mechanism comprises: inquiry is idle, in inquiry, successful inquiring and inquiry failure; After initialization, status mechanism should be the inquiry free time.
Judge the status mechanism of current domain name system queries, if the inquiry free time jumps to step 4, if exit nslookup in inquiry, resolve.
Step 4, the domain name that will inquire about are imported into, and the domain name in the domain name system of the domain name transmitting and voice process is compared, and judge whether domain name system has this domain name of importing into, if so, jumps to step 5, if not, jumps to step 6.
Step 5, carry out domain name mapping and obtain corresponding IP address, and array corresponding to this domain name and corresponding IP address thereof import into, change status mechanism into successful inquiring, and jump to step 7.
Step 6, status mechanism be for to inquire about unsuccessfully, and jump to step 4 and again inquire about and domain name mapping.
Step 7, the database that the domain name of successful inquiring and corresponding IP address thereof are joined to the domain name system of voice process store, convenient inquiry next time.
In the present embodiment, preferably, when step 4 is inquired about, can lock to there being the file of domain name and IP address corresponding relation, after making to lock, just only allow this process use this file, other process can not be called, and needs this process to execute or after default execution certain hour, other process just can be called, and after step 6 poll-final, above-mentioned file is carried out to release.
Although content of the present invention has been done detailed introduction by above preferred embodiment, will be appreciated that above-mentioned description should not be considered to limitation of the present invention.Those skilled in the art, read after foregoing, for multiple modification of the present invention with to substitute will be all apparent.Therefore, protection scope of the present invention should be limited to the appended claims.