A kind of included domain name analytic method of the voice for home gateway
Technical field
The present invention relates to voices to carry domain name mapping technology, and in particular to a kind of included domain name of the voice for home gateway
Analytic method.
Background technique
Domain name mapping is that domain name is directed toward web space IP, allows people that net is accessed with can be convenient by the domain name registered
It stands a kind of service.Domain name mapping also makes domain name be directed toward, server setting, domain name configures and reversely IP registration etc..Say simple
Single-point is exactly by domain name mapping easy to remember into IP, and it is domain name mapping to an IP address, so that service is completed by dns server
A subdirectory and domain name are bound on the host of this IP address afterwards.
VoIP(Voice over Internet Protocol) it is in brief exactly by analog signal (Voice) number
Change, does real-time delivery on IP network (IP Network) in the form of data packet (Data Packet).VoIP is maximum excellent
Gesture is the environment that can be widely interconnected using Internet and global ip, provides more than traditional business, better service.VoIP
Can business such as cheap transmission voice, fax, video and data on ip networks, as unified messaging service, virtual telephony,
Virtual speech/fax mailbox, directory enquiry service, the call center Internet, Internet call manager, video conference, electronics quotient
Business, fax storage forwarding and the storage of various information forwarding etc..The basic principle of VoIP is: by the compression algorithm of voice to language
Sound data encoding carries out compression processing, then these voice data is packaged by TCP/IP standard, by IP network
Data packet is sent to receiving, then these VoPs are stringed together, after decompression processing, reverts to original voice letter
Number, to achieve the purpose that by Internet transmission voice.The core and key equipment of IP phone are IP gateways, it is various regions
Area's area code is mapped as corresponding regional gateway ip address.These information are stored in a database, at data connecting
The functions such as call treatment, digital speech packing, routing management will be completed by managing software.When user dials long-distance call, gateway root
According to area code database data, the address IP of respective gateway is determined, and this address IP is added in IP data packet, simultaneously
Optimization route is selected, to reduce propagation delay time, the gateway that IP data packet is arrived at the destination through Internet.Some
Internet is not yet extended to or is not set up the area of gateway temporarily, and settable routing passes through long-distance call by nearest gateway
Net switching, realizes communication service.
And what voice registrar, proxy server and out proxy server may be filled in is domain name, this when
Time just needs to carry out domain name mapping.
Existing technical disadvantages are: when registrar, proxy server, out proxy server are domain names,
Voice process, which needs to send asynchronous message to domain name system (Domain Name System, DNS) process, to be parsed, and is parsed
DNS process retransmits message to voice process to obtain the real address ip afterwards, ductility when causing, under efficiency.
Summary of the invention
The present invention provides a kind of included domain name analytic method of the voice for home gateway, under voice process, creation line
Journey is parsed by thread, high-efficient, strong real-time, and relatively more accurate.
To achieve the above object, the present invention provides a kind of included domain name analytic method of the voice for home gateway, special
Point is that the method includes the steps of:
The array for storing nslookup and the corresponding address ip is created under step 1, voice process, the array is initial
Change empties;
Step 2, voice process creation domain name system thread, for handling the request analysis of domain name system under voice process;
Step 3 inquires status mechanism, and status mechanism includes: inquiring in idle, inquiry, successful inquiring and inquiry fail;Just
Status mechanism is that inquiry is idle after beginningization;
The status mechanism of current Domain Name System query is judged, if the inquiry free time then jumps to step 4, if in inquiry then
It returns;
Step 4, the domain name that will be inquired are incoming, and the domain name in the domain name system of the domain name transmitted and voice process is carried out
Compare, judge the domain name whether domain name system has this incoming, if then jumping to step 5, if otherwise jumping to step 6;
Step 5 carries out the corresponding IP address of domain name mapping acquisition, and the domain name and its corresponding IP address is passed to and corresponded to
Array, status mechanism is changed to successful inquiring, jumps to step 7;
Step 6, status mechanism are inquiry failure, and jump to step 4 and inquire again;
Step 7, the domain name of successful inquiring and its corresponding IP address are added to voice process domain name system data
Library is stored.
When above-mentioned steps 4 are inquired, to storing domain name and the file of IP address corresponding relationship locks;And in step
Rapid 6 complete to be unlocked when inquiry.
Compared to the prior art a kind of voice for home gateway of the present invention carries domain name analytic method, advantage exists
In the present invention carries out parsing domain name addresses by thread by one thread of creation, effectively reduces the waste of resource, and can
The true address of domain name mapping required for quickly obtaining, and retain this address, high-efficient, strong real-time, accuracy height.
Detailed description of the invention
Fig. 1 is the flow chart that a kind of voice for home gateway of the present invention carries domain name analytic method.
Specific embodiment
Below in conjunction with attached drawing, specific embodiments of the present invention are further illustrated.
As shown in Figure 1, the present invention discloses a kind of included domain name analytic method of the voice for home gateway, this method includes
Following steps:
The array for storing nslookup and corresponding IP address is created under step 1, voice process (voice), by this
Array carries out initialization and empties.
Step 2, voice process creation domain name system thread, for handling the request analysis of domain name system under voice process.
Step 3 inquires status mechanism, and status mechanism includes: inquiring in idle, inquiry, successful inquiring and inquiry fail;Just
It is idle to should be inquiry for status mechanism after beginningization.
The status mechanism of current Domain Name System query is judged, if the inquiry free time then jumps to step 4, if in inquiry then
Exit nslookup parsing.
Step 4, the domain name that will be inquired are incoming, and the domain name in the domain name system of the domain name transmitted and voice process is carried out
Compare, judge the domain name whether domain name system has this incoming, if so, step 5 is jumped to, if it is not, then jumping to step 6.
Step 5 carries out the corresponding IP address of domain name mapping acquisition, and the domain name and its corresponding IP address is passed to and corresponded to
Array, status mechanism is changed to successful inquiring, and jump to step 7.
Step 6, status mechanism are inquiry failure, and jump to step 4 and inquire again and domain name mapping.
Step 7, the domain name of successful inquiring and its corresponding IP address are added to voice process domain name system data
Library is stored, and next inquiry is facilitated.
It in the present embodiment, can be to the text for having domain name Yu IP address corresponding relationship preferably, in step 4 inquiry
Part is locked, so that just only allowing this process using this file after locking, other processes are not capable of calling, this process is needed to hold
It has gone or has been executed after a certain period of time preset, other processes can just be called, and after step 6 poll-final, to above-mentioned text
Part is unlocked.
It is discussed in detail although the contents of the present invention have passed through above preferred embodiment, but it should be appreciated that above-mentioned
Description is not considered as limitation of the present invention.After those skilled in the art have read above content, for of the invention
A variety of modifications and substitutions all will be apparent.Therefore, protection scope of the present invention should be limited to the appended claims.