Summary of the invention
The technical problem that the present invention mainly solves provides method of calling and the portable terminal in a kind of voice communication, can effectively reduce communication cost, also guarantees the instantaneity of voice communication simultaneously.
For solving the problems of the technologies described above, the technical scheme that the present invention adopts is: the method for calling in a kind of voice communication is provided, and said method comprises: when the callee makes a call, judging whether to connect the Internet; If said being judged as is to judge then whether calling party and callee have all logined Internet Server; If said being judged as is then select the internet call callee, otherwise the selection mobile communications network to be called out the callee.
Wherein, Said judge whether calling party and callee have all logined the step of Internet Server before; Comprise: the mobile terminal number that utilizes calling party is as account number and through network protocol stack login Internet Server; If Internet Server is gone up in login; Then be recorded as presence, otherwise be recorded as not presence.
Wherein, The said step of judging whether calling party and callee have all logined Internet Server comprises: the presence that in Internet Server, writes down through network protocol stack returns judges whether calling party and callee have all logined Internet Server; That network protocol stack returns is calling party and all online result of callee, then is judged as calling party and callee and has all logined Internet Server; If that network protocol stack returns is calling party or the not online result of callee, then being judged as calling party and callee is not all to have logined Internet Server.
Wherein, Saidly judging whether that when the callee makes a call the step that connects the Internet comprises: the result who returns according to call function judges whether to connect through network protocol stack and goes up the Internet; If the result that call function returns is 0, then is judged as not connect and goes up the Internet through network protocol stack; If the result that call function returns is 1, then is judged as through the network protocol stack connection and goes up the Internet.
For solving the problems of the technologies described above, another technical scheme that the present invention adopts is: a kind of portable terminal is provided, and said portable terminal comprises: first judging unit is used for when the callee makes a call, judging whether to connect the Internet; Second judging unit when being used on being judged as connection the Internet, judges whether calling party and callee have all logined Internet Server; Selected cell is used for when judging that calling party and callee have all logined Internet Server, then selecting the internet call callee, otherwise, select mobile communications network to call out the callee.
Wherein, Said portable terminal comprises log-in unit; Be used for before judging whether calling party and callee have all logined Internet Server; The mobile terminal number that utilizes calling party is as account number and through network protocol stack login Internet Server; If Internet Server is gone up in login; Then be recorded as presence, otherwise be recorded as not presence.
Wherein, Said portable terminal comprises network protocol stack module, communication protocol stack module and signal processing module; Said network protocol stack module links to each other with said first judging unit, second judging unit, log-in unit, selected cell and signal processing module; Said communication protocol stack module links to each other with said selected cell and signal processing module; Said signal processing module; Link to each other with said network protocol stack module, communication protocol stack module and selected cell; Be used for the function that when said selected cell is selected internet call, realizes calling out the callee with the network protocol stack module; Or, the function that when said selected cell selects mobile communications network to call out, realizes calling out the callee with the communication protocol stack module; Said first judging unit, second judging unit, selected cell and log-in unit are arranged in the central processing module.
Wherein, Said portable terminal comprises second judging unit; Specifically be used for when judging whether calling party and callee have all logined Internet Server; The presence that in remote server, writes down through the network protocol stack module is returned judges whether calling party and callee have all logined Internet Server; As if what return through the network protocol stack module is calling party and all online result of callee, then is judged as calling party and callee and has all logined Internet Server; As if what return through the network protocol stack module is calling party and all not online result of callee, and then being judged as calling party and callee is not all to have logined Internet Server.
Wherein, Said first judging unit specifically is used for when when the callee makes a call, judging whether to connect the Internet; The result who returns according to call function judges whether to connect upward the Internet through the network protocol stack module; If the result that call function returns is 0, then is judged as not connect and goes up the Internet through the network protocol stack module; If the result that call function returns is 1, then is judged as through the connection of network protocol stack module and goes up the Internet.
For solving the problems of the technologies described above, another technical scheme that the present invention adopts is: a kind of portable terminal is provided, and said portable terminal comprises: judge module is used for when receiving calling, judging that whether said calling is from the Internet; Select module, be used for being judged as when being, then select the Internet to carry out voice communication, otherwise select mobile communications network to carry out voice communication said.
The invention has the beneficial effects as follows: it almost is that free internet carries out voice communication, makes the situation that the voice communication expense is high that the mobile phone that is different from prior art can't effectively be selected; The present invention at mobile phone when the callee makes a call; Automatically judge whether mobile phone and callee connect the internet; If mobile phone and callee connect the internet; Then select the internet to make a call; The callee is after receiving calling; Judge and whether call out from the internet; If call out from the internet; Then select the internet to carry out voice communication; Because mobile phone can judge and preferentially select the internet of almost free to carry out voice communication automatically; This just greatly reduces communication cost; Even mobile phone and callee have a side do not have to connect on the calling initiated of internet or mobile phone be not during from the internet; Mobile phone can also select mobile communications network to carry out voice communication automatically, can guarantee the instantaneity of voice communication so again.
Embodiment
Below in conjunction with accompanying drawing and embodiment the present invention is elaborated.
See also Fig. 1, the flow chart of the method for calling in the voice communication that the embodiment of the invention provides comprises:
Step 101: when the callee makes a call, judging whether to connect the Internet;
Calling party is selected callee's name or input called number from telephone directory, make a call to the callee, and simultaneously, the result who returns according to call function judges whether to connect through network protocol stack to go up the Internet.Portable terminal can be through calling special api function; Be used for detecting current network connection state; Different systems soft wares has different api function names; Call the state that IsConnected () function returns network such as some software systems; If the result that call function returns is 0; Then be not judged as to connect and go up the Internet, afterwards, select mobile communications network and make a call to the callee through communication protocol stack through network protocol stack; If the result that call function returns is 1, then be judged as through the network protocol stack connection and go up the Internet, whether portable terminal can be judged network protocol stack easily through call function and can work, and promptly whether portable terminal can connect wireless network.
Be judged as connect the Internet through network protocol stack before; The mobile terminal number that can utilize calling party earlier is as account number and through network protocol stack login Internet Server; Can certainly use other preset numbers of portable terminal, login Internet Server through network protocol stack as the account number of binding mobile terminal number.If Internet Server is gone up in login, then be recorded as presence, otherwise be recorded as not presence.In more design, can after not being recorded as presence, continuation login Internet Server again, Deng Lu number of times can be set a threshold value again.
Particularly; Portable terminal is based on ICP/IP protocol; Utilize network protocol stack to realize login; Such as the login mode that uses common website, transmit mobile terminal number through procotol earlier, wait for the Internet Server response then; If response success; So just illustrate that successfully login or success are online, portable terminal records the presence of oneself in the presence variable of this machine, and Internet Server also can be recorded in the information that success is logined in the database of oneself simultaneously.If Internet Server does not have response or the wrong mobile terminal number of response, so just illustrate that login failure perhaps goes offline, and in Internet Server, carry out record; Equally, portable terminal also can be by in the presence variable of this machine of recording this state.
When portable terminal with after Internet Server is connected; This connection is kept always; Because what use is ICP/IP protocol; This agreement allows communicating pair to keep constantly connecting; Either party loses communicating pair in connection; Can be perceived by an other side (Internet Server or portable terminal), lose such as because communication failure or a certain side's power down if connect, a so other side will make suitable response.Find to connect disconnection such as Internet Server; It is online in the database of oneself, to write down this mobile terminal number so; If finding to connect, breaks off portable terminal; So portable terminal should at first revise oneself the presence variable for not online; Attempt connecting again Internet Server then; After successful connection, just be revised as the presence variable online.
Step 102: if said being judged as is to judge then whether calling party and callee have all logined Internet Server;
In step 101; On judging, just carry out this step after the Internet through the network protocol stack connection; Specifically: the presence that in Internet Server, writes down through network protocol stack returns judges whether calling party and callee have all logined Internet Server; That network protocol stack returns is calling party and all online result of callee, then is judged as calling party and callee and has all logined Internet Server; If that network protocol stack returns is calling party or the not online result of callee, then being judged as calling party and callee is not all to have logined Internet Server.
Wherein, The callee utilizes its mobile terminal number to go up Internet Server through network protocol stack login Internet Server if login as account number; Then be recorded as presence, otherwise be recorded as not presence, and login Internet Server again after the presence not being recorded as.Judge that method or standard that whether the callee logins Internet Server can freely design; Give Internet Server such as sending called number through network protocol stack; Internet Server begins the local data library inquiry after receiving this telephone number; It is online to check whether this number has been registered as; If it is online then return the signal of calling party " callee is online " through network protocol stack; Otherwise, return the signal of calling party " callee is not online " through network protocol stack.
Step 103: if said being judged as is then select the internet call callee, otherwise the selection mobile communications network to be called out the callee;
Being judged as after calling party and callee all logined Internet Server, select the Internet and open network protocol stack to call out the callee; Be judged as calling party and callee be not all logined Internet Server after, select mobile communications network and call out the callee through communication protocol stack.
In addition, the callee carries out following steps after the calling that receives the calling party initiation:
Step 1: judge and whether call out from the Internet;
Whether portable terminal can oneself connect the Internet through the network protocol stack inspection constantly; If the presence of Internet Server sign oneself just can be logined in the Internet in the connection; This state can also can be recorded in the local presence variable by the data-base recording of Internet Server.If own online, calling party makes a call through the Internet, and this call signal is delivered to through the Internet in the antenna of oneself so, is delivered in the network protocol stack again, is resolved to call signal; If oneself do not have online; Communication protocol stack can receive call signal so; Pass to communication protocol stack through main antenna, resolved to call signal, portable terminal still is to be resolved by communication protocol stack to judge that whether calling is from the Internet through judging that call signal is resolved by network protocol stack.
Wherein, Network protocol stack is based on the ICP/IP protocol standard signal is carried out the encoding and decoding processing; Promptly primary signal is encoded into the network signal form, and through wireless network antenna be delivered on the Internet or wireless network antenna on the internet signal received, be decoded into primary signal; Communication protocol stack is responsible for signal of communication that main antenna is received, resolves to common audio digital signals or audio digital signals is packaged into the standard traffic signal to send out through main antenna.Standard ability and base station that communication protocol stack must meet 3GPP communicate; It generally comprises the hardware DSP with quick computing capability; And software protocol stack; Cooperation through software and hardware can be carried out real time parsing and transmission to the signal of receiving; Existing portable terminal generally all can use special SOC (system on a chip) (System on a Chip; SOC) chip is realized the function of communication protocol stack, and the supplier of this type Soc has a lot, such as Mediatek, Qualcomm or the like.
Step 2: when judging calling from the Internet, then the prompting user has new incoming call on the screen of portable terminal, and startup internet protocol-based voice (Voice over Internet Protocol, VoIP) response of the internet program of technology should be called out; When judging calling is not from the Internet, and then the prompting user has new incoming call on the screen of portable terminal, and startup should be called out based on the mobile communications network program response of network formats such as 2G/3G normally.
Present embodiment can further be made requirement; After in a single day the portable terminal of communicating pair is connected to the Internet; Just login Internet Server immediately, and in the database of Internet Server record communication both sides' connection status, and communicating pair keeps and being connected of Internet Server.Like this, behind the portable terminal of the communicating pair login Internet Server, Internet Server just knows that the portable terminal of communicating pair all is ready to, and can carry out voice communication through the Internet at any time.
Utilize the voice communication of the Internet can pass through several different methods; Set up peer-to-peer network such as communicating pair through TCP/IP; Carry out reciprocity voice communication through voip technology between peer-to-peer network; This communication does not take server resource; Save server bandwidth, also have a kind of method based on Internet Server, promptly communicating pair sends to speech message earlier the Internet Server that mediates; Internet Server is forwarded to the opposing party again, accomplishes communication.
The essence of the Internet is data communication network; Mobile communications network is also supported data communication service at a high speed; High-speed packet such as based on the 3.5G network inserts (high speed packet access; HSPA) data service; In theory; Use the HSPA high-speed data communication also can realize similar function, but HSPA charge, and utilizes the wireless Internet meeting more cheap.Present embodiment can't the restricting data network bearing mode, as long as select optimum data communication network.
It almost is that free the Internet carries out voice communication, makes the situation that the voice communication expense is high that the mobile phone that is different from prior art can't effectively be selected; The present invention can judge and preferentially select the wireless Internet of almost free to carry out voice communication automatically; Reduce communication cost; And communicating pair has a side not connect when going up the Internet; Portable terminal can also select mobile communications network to carry out voice communication automatically, guarantees the instantaneity of voice communication.
See also Fig. 2, the sketch map of the voice communication system that the embodiment of the invention provides, said system comprises: first portable terminal 1, second portable terminal 2 and Internet Server 3.Wherein, first portable terminal 1 comprises that communication module 11 and telephone directory administration module 12, the second portable terminals 2 comprise communication module 21 and telephone directory administration module 22.The inner communication module of the communication module 11 that first portable terminal 1 is inner and second portable terminal 2 21 is integrated internet communication service and mobile network communication service; Internet communication service can be that (WirelessFidelity WIFI) is connected to the data, services that obtains behind the Internet to Wireless Fidelity; The inner telephone directory administration module 12 of first portable terminal 1 is responsible for the answering, dial and contact person's maintenance or the like of voice of first portable terminals 1, and second portable terminal, 2 inner telephone directory administration modules 22 are responsible for the answering, dial and contact person's maintenance or the like of voice of second portable terminals 2; Internet Server 3 is used to write down the state of first portable terminal 1 and second portable terminal, 2 login the Internets.
In the first mobile terminal 1 via its telephone call management module 12 before the second mobile terminal 2, the first mobile terminal 1 via its communication module 11 determines whether they are already connected to the Internet, if not connected to the Internet, then select the first mobile communication network second mobile terminal 2 initiates a call, the second mobile terminal 2 phonebook management module 22 answers the call, the mobile terminal 2 via the second communication module 21 with the first mobile terminal 1 for voice communication; if you have connected to the Internet, the first Log on to the Internet, the mobile terminal 1 and the server 3, the online record, the mobile terminal 2 then checks whether the second line, if the second mobile terminal 2 is not online, select the mobile communication network 2 to the second mobile terminal to initiate a call, the second the mobile terminal 2 contacts management module 22 answers the call, the mobile terminal 2 via the second communication module 21 with the first mobile terminal 1 for voice communication, the mobile terminal 2 if the second line, select the Internet to the second mobile terminal 2 initiate a call, the second mobile terminal 2 phonebook management module 22 to answer the call, the mobile terminal 2 through the second communication module 21 with the first mobile terminal 1 for voice communication, or:
In the second mobile terminal 2 via its telephone call management module 22 before the first mobile terminal 1, the second mobile terminal 2 via the communication module 21 is connected to the Internet determine whether, and if not connected to the Internet, the selection to the second mobile communication network a moving terminal 1 to initiate a call, the first mobile terminal 1 phonebook management module 12 to answer the call, the mobile terminal 1 via the first communication module 11 and the second mobile terminal 2 for voice communication; if you have connected to the Internet, the second Log on to the Internet, the mobile terminal 2 and the server 3, the online record, the mobile terminal 1 then checks whether the first line, if the first mobile terminal 1 is not online, select the mobile communication network to the first mobile terminal 1 initiates a call, the first the mobile telephone terminal 1 to answer the call management module 12, the mobile terminal 1 via the first communication module 11 and the second mobile terminal 2 for voice communication, the mobile terminal 1 if the first line, then select the Internet to the first mobile terminal 1 initiate a call, the first mobile terminal 1 phonebook management module 12 answers the call, the mobile terminal 1 through the first communication module 11 and the second mobile terminal 2 for voice communication.
See also Fig. 3, the sketch map of a kind of portable terminal that the embodiment of the invention provides comprises: central processing module 4, communication protocol stack module 5, network protocol stack module 6 and signal processing module 7.Be provided with first judging unit 41, log-in unit 42, second judging unit 43 and selected cell 44 in the central processing module 4.
Network protocol stack module 6 links to each other with first judging unit 41, log-in unit 42, second judging unit 43, selected cell 44 and signal processing module 7; Network protocol stack module 6 is based on the ICP/IP protocol standard signal is carried out the module that encoding and decoding are handled; This module can be that software module also can be a hardware module; The effect of network protocol stack module 6 is that primary signal is encoded into the network signal form, and is delivered on the Internet through wireless network antenna; Perhaps, be decoded into primary signal and transfer to signal processing module 7 processing the internet signal of receiving on the wireless network antenna.
Communication protocol stack module 5 links to each other with selected cell 44 and signal processing module 7.The communication protocol stack module 5 responsible signals of communication that main antenna is received resolve to common audio digital signals, and pass to signal processing module 7.In one embodiment; The standard ability and the base station that require communication protocol stack module 5 to meet 3GPP communicate; It generally comprises the hardware DSP with quick computing capability; And software protocol stack; Cooperation through software and hardware can be carried out real time parsing and transmission to the signal of receiving, modern mobile phone generally all can use special SOC (system on a chip) SOC chip to realize the function of this communication protocol stack, and the supplier of this type Soc has a lot; Such as Mediatek, Qualcomm or the like.
Signal processing module 7; Link to each other with communication protocol stack module 5, network protocol stack module 6 and selected cell 44; Be used for when selected cell 44 is selected internet call, communicating by letter with network protocol stack module 6; Or,, selected cell 44 communicates by letter when selecting mobile communications network to call out with communication protocol stack module 5.Signal processing module 7 is that a software module also can be a hardware module; It is responsible for Digital Signal Processing is become can be by the voice signal of loudspeaker acceptance; Conversely; Also voice signal is become digital signal; This module can use various signal processing algorithms, and such as noise reduction process, encrypting and decrypting is handled or the like; These processing can be calculated by computing chip through proprietary program and accomplished, and also can accomplish through proprietary hardware computing chip computing.Signal processing module 7 not only can pass to original communication protocol stack module 5 to primary speech signal and transmit; Also can pass to network protocol stack module 6 to signal and transmit, central processing module 4 according to algorithm determined automatically this process communication protocol stack module 5 of signal still this process network protocol module 6 transmit.
Central processing module 4 is coordinated the whole voice communication course of control; When being responsible for new signal and having arrived; Signal is responded; When being arranged, incoming call notify the user to respond; Opening signal passage (receiving calls); The signal of the signal of communication protocol stack module 5 or network protocol stack module 6 is delivered in the signal processing module 7 in order and control signal or the like; Also be responsible for notifying communication protocol stack module 5 or network protocol stack module 6 and set up new call link (outbound calling), and after passage is connected, the signal of signal processing module 7 is imported in communication protocol stack module 5 or the network protocol stack module 6.Central processing module 4 is to realize it and coordinate the function of control voice communication through being arranged at each unit in it.
The concrete effect of each unit is following:
First judging unit 41; Be used for when the callee makes a call, judging whether to connect the Internet; Particularly; The result who returns according to call function judges whether to connect upward the Internet through network protocol stack module 6; If the result that call function returns is 0, then is judged as not connect and goes up the Internet through network protocol stack module 6; If the result that call function returns is 1, then is judged as through 6 connections of network protocol stack module and goes up the Internet.First judging unit can be through calling special api function; Be used for detecting current network connection state; Different systems soft wares has different api function names; Call the state that IsConnected () function returns network such as some software systems; If the result that call function returns is 0; Then be not judged as to connect and go up the Internet, afterwards, select mobile communications network and make a call to the callee through communication protocol stack module 6 through network protocol stack module 6; If the result that call function returns is 1, then is judged as through 6 connections of network protocol stack module and goes up the Internet.Whether first judging unit 41 can be judged network protocol stack module 6 easily through call function and can work.
Be judged as connect the Internet through network protocol stack module 6 before; Also can after; Log-in unit 42 utilizes the mobile terminal number of calling party to login Internet Servers as account number through network protocol stack module 6; Can certainly use other preset numbers of portable terminal to login Internet Servers through network protocol stack module 6 as account number; If Internet Server is gone up in login; Then be recorded as presence; Otherwise be recorded as not presence, and login Internet Server again after the presence not being recorded as.
Particularly; Log-in unit 42 is based on ICP/IP protocol; Utilize network protocol stack module 6 to realize login; Such as the login mode that uses common website, transmit mobile terminal number through network protocol module 6 earlier, wait for the Internet Server response then; If response success; So just illustrate that successfully login or success are online, portable terminal records the presence of oneself in the presence variable, and Internet Server also can be recorded in the information that success is logined in the database of oneself simultaneously.If Internet Server does not have response or the wrong mobile terminal number of response, so just illustrate that login failure perhaps goes offline, same, portable terminal also can be recorded in this state in the line state variable.When portable terminal with after Internet Server is connected; This connection is kept always; Because what use is ICP/IP protocol; This agreement allows communicating pair to keep constantly connecting; Either party loses communicating pair in connection; Can be perceived by an other side (Internet Server or portable terminal), lose such as because communication failure or a certain side's power down if connect, a so other side will make suitable response.Find to connect disconnection such as Internet Server; It is online in the database of oneself, to write down this mobile terminal number so; If finding to connect, breaks off portable terminal; So portable terminal should at first revise oneself the presence variable for not online; Attempt connecting again Internet Server then; After successful connection, just be revised as the presence variable online.
Second judging unit 43; When being used on being judged as connection the Internet; Judge whether calling party and callee have all logined Internet Server; Particularly; The presence that in remote server, writes down through network protocol stack module 6 is returned judges whether calling party and callee have all logined Internet Server; As if what return through network protocol stack module 6 is calling party and all online result of callee, then is judged as calling party and callee and has all logined Internet Server; As if what return through network protocol stack module 6 is calling party and all not online result of callee, and then being judged as calling party and callee is not all to have logined Internet Server.
Wherein, The callee utilizes its mobile terminal number as account number and through network protocol stack module 6 login Internet Servers; If Internet Server is gone up in login; Then be recorded as presence; Otherwise be recorded as not presence, and login Internet Server again after the presence not being recorded as.Judge that method or standard that whether the callee logins Internet Server can freely design; Give Internet Server such as sending called number through network protocol stack module 6; Internet Server begins the local data library inquiry after receiving this telephone number; It is online to check whether this number has been registered as; If it is online then return the signal of calling party " callee is online " through network protocol stack module 6; Otherwise, return the signal of calling party " callee is not online " through network protocol stack module 6.
Selected cell 44 is used for being judged as when being said, then selects the internet call callee, otherwise, select mobile communications network to call out the callee.Such as, being judged as after calling party and callee all logined Internet Server at second judging unit 43, selected cell 44 selection the Internets and open network protocol stack module 6 are called out callees; Second judging unit 43 be judged as calling party and callee be not all logined Internet Server after, selected cell 44 is selected mobile communications networks and is called out the callee through communication protocol stack.
See also Fig. 4, the another kind of portable terminal sketch map that the embodiment of the invention provides comprises:
Judge module 81 is used for when receiving calling, judging that whether said calling is from the Internet;
Whether portable terminal can oneself connect the Internet through the network protocol stack inspection constantly; If the presence of Internet Server sign oneself just can be logined in the Internet in the connection; This state can also can be recorded in the local presence variable by the data-base recording of Internet Server.If own online, calling party makes a call through the Internet, and this call signal is delivered to through the Internet in the antenna of oneself so, is delivered in the network protocol stack again, is resolved to call signal; If oneself do not have online; Communication protocol stack can receive call signal so; Pass to communication protocol stack through main antenna, resolved to call signal, portable terminal still is to be resolved by communication protocol stack to judge that whether calling is from the Internet through judging that call signal is resolved by network protocol stack.
Select module 82, be used for being judged as when being, then select the Internet to carry out voice communication, otherwise select mobile communications network to carry out voice communication said;
When judging calling from the Internet, then the prompting user has new incoming call on the screen of portable terminal, and startup internet protocol-based voice (Voice over Internet Protocol, VoIP) response of the internet program of technology should be called out; When judging calling is not from the Internet, and then the prompting user has new incoming call on the screen of portable terminal, and startup should be called out based on the mobile communications network program response of 2G/3G normally.
The above only is embodiments of the invention; Be not so limit claim of the present invention; Every equivalent structure or equivalent flow process conversion that utilizes specification of the present invention and accompanying drawing content to be done; Or directly or indirectly be used in other relevant technical fields, all in like manner be included in the scope of patent protection of the present invention.