Summary of the invention
The present invention mainly provides a kind of communication mode that replaces existing instruction type communication, the state synchronized problem when solving multithreading communication, and realize and communication terminal with a plurality of extension sets communicates.
For solving the problems of the technologies described above, the technical scheme that the present invention adopts is: a kind of method of communicating by letter with the communication terminal with a plurality of extension sets is provided, comprises step:
Call out the number of described communication terminal;
Obtain the IP address list of all extension sets in this communication terminal according to the number of communication terminal;
All IP addresses in the IP address list send the communications status of self, and wherein, communications status is packaged in the UDP bag;
The communications status of this extension set that each extension set is replied in the received communication terminal, wherein, communications status is packaged in the UDP bag;
Analyzing and processing also responds the communications status of this extension set that each extension set replys.
Wherein, described analyzing and processing and the communications status that responds this extension set that each extension set replys are specially:
If the communications status that one or more extension set is replied is for conversing with third party device, end of calling then;
If the communications status that extension set is replied at jingle bell, waits for then that extension set answers for just, if extension set ring unanswered or a wherein extension set rejection in the scheduled time, then end of calling if wherein an extension set is answered, is then set up one to one with this extension set and is conversed.
Wherein, describedly be specially when there being extension set to answer then the step of setting up one to one conversation with this extension set:
The communications status of self is set to converse, and adds the IP address of connecting extension set in communications status;
Self communications status form with the UDP bag is sent to each extension set;
Receive the communications status that each extension set is replied with the UDP packet form, judge whether each extension set is hung up, no longer send communications status to this extension set if hang up then; If do not hang up, then continue to this extension set send self communications status until except answering extension set other extension sets all hang up, thereby then only send communications status and this extension set and set up one to one and converse to answering extension set.
Wherein, after described and extension set is set up one to one conversation, send communications status until end of conversation with predetermined space to this extension set.
Wherein, described when obtaining IP address list, also judge whether to obtain successfully, if obtain then end of calling of failure, successfully then carry out next step if obtain.
Wherein, in the step of the communications status of this extension set that each extension set is replied in the described received communication terminal, if the answer that does not receive in the given time any extension set end of calling then.
The present invention also provides a kind of communication equipment, and it can communicate with the communication terminal with a plurality of extension sets, comprising: calling unit, for the number of calling out described communication terminal; The IP address acquisition unit is for the IP address list that obtains these all extension sets of communication terminal according to the number of communication terminal; The communications status transmitting element is used for to the communications status of all IP addresses transmissions self of IP address list, and wherein, communications status is packaged in the UDP bag; The communications status receiving element is used for the communications status of this extension set that each extension set of received communication terminal replys, and wherein, communications status is packaged in the UDP bag; The communications status processing unit is used for analyzing and processing and responds the communications status of this extension set that each extension set replys.
Wherein, described communications status processing unit also is set to converse for the communications status of self after having extension set to answer, and adds the IP address of answering extension set in communications status, and this communications status is transferred to described communications status transmitting element transmission.
Wherein, described communication equipment further comprises: judging unit, be used for when obtaining IP address list, judging whether to obtain successfully, and then point out end of calling if obtain failure, successfully then trigger the work of described communications status transmitting element if obtain.
Wherein, described communication equipment further comprises: timing unit is used for timing after described communications status transmitting element sends communications status, if described communications status receiving element does not receive that the answer of any extension set then points out end of calling in the given time.
The invention has the beneficial effects as follows: be different from the past based on the communication mode of ordering, the method of communicating by letter with the communication terminal with a plurality of extension sets among the present invention is the communication of state-based, and transmit with the form of UDP bag, in communication process, contain the UDP bag of communications status and receive that the UDP that contains communications status that the other side replys wraps to judge whether to set up communication connection and whether communication connection status changes by transmission.Communication process is simple, and the report communications status only needs an information, and control command generally all needs many in the existing communication based on ordering; Communications status does not need wait acknowledge after sending, and can judge how to process according to the communications status that the other side replys.And be directly to send to each extension set after obtaining first the IP address of each extension set to the communications status that communication terminal sends, can guarantee that all extension sets all can receive call request, solve the nonsynchronous problem of each extension set state in the communication terminal.The resource that the method need to take is little, is particularly suitable for embedded device.
Embodiment
By describing technology contents of the present invention, structural feature in detail, realized purpose and effect, below in conjunction with execution mode and cooperate that accompanying drawing is detailed to give explanation.
For ease of understanding, paper is used the system architecture of method of the present invention, in a communication system, has a plurality of communication terminals, and each communication terminal all is connected into IP network, and IP network can be the Internet, metropolitan area network, local area network (LAN) etc.Wherein, have in certain or some communication terminals and have a plurality of extension sets, each extension set is arranged in consolidated network by being connected on the switch with other communication terminals and can communicates by letter mutually, and each extension set has independently IP address, but shares the same call number.For example, if communication system is a building intercom system, and the communication terminal with a plurality of extension sets is the resident family's machine that is installed in the man of resident family, with the room number of resident family as call number, then each extension set has different IP addresses, but (ladder-port machine and administrative center) shows as the same call number to other communication terminals, namely when by ladder-port machine or administrative center resident family's machine being called out, just room number called out.
Consult Fig. 1 and Fig. 2, the method for communicating by letter with the communication terminal with a plurality of extension sets among the present invention comprises step:
S10: the number of calling out described communication terminal; Wherein, this calling is to be initiated by calling party's (the caller equipment of hereinafter mentioning also refers to the calling party), and the number of communication terminal is that system sets in advance, and for example for the building conversational system that the preceding paragraph is mentioned, number can be room number or administrative center.
S20: the IP address list that obtains all extension sets in this communication terminal according to the number of communication terminal; Preferably, also judge in this step and whether successfully to obtain IP address list, if obtain then end of calling of failure, successfully then carry out next step if obtain; Wherein, the IP address of each extension set is distributed in advance by management software, and manager understands the corresponding relation of stored calls number and IP address, obtaining IP address list in this step can be that caller equipment obtains the result to manager's inquiry in real time, also can be that caller equipment downloads to all communication terminal numbers and corresponding IP address on the local disk first before, search the acquisition result from local data during calling;
S30: all the IP addresses in the IP address list send the communications status of self, and wherein, communications status is packaged in the UDP bag;
S40: the communications status of this extension set that each extension set is replied in the received communication terminal, wherein, communications status is packaged in the UDP bag; Wherein, in this step, if do not receive the answer of any extension set within a scheduled time, indication equipment goes offline or other network failures, end of calling;
S50: analyzing and processing also responds the communications status of this extension set that each extension set replys.Particularly, consult Fig. 2, if the communications status that one or more extension set is replied for the third party device conversation, then the calling party can receive that prompting the other side does end of calling; If the communications status that extension set is replied at jingle bell, waits for then that extension set answers for just, if interior extension set ring unanswered of the scheduled time then the calling party can receive ring unanswered's prompting, end of calling; If a wherein extension set rejection, then the calling party can receive the prompting of the other side's rejection, end of calling; If wherein an extension set is answered, then set up one to one conversation with this extension set.
The method adopts the communication of state-based, and transmit with the form of UDP bag, in communication process, contain the UDP bag of communications status and receive that the UDP that contains communications status that the other side replys wraps to judge whether to set up communication connection and whether communication connection status changes by transmission.Communication process is simple, and the report communications status only needs an information, and control command generally all needs many in the existing communication based on ordering; Communications status does not need wait acknowledge after sending, and can judge how to process according to the communications status that the other side replys.And be directly to send to each extension set after obtaining first the IP address of each extension set to the communications status that communication terminal sends, can guarantee that all extension sets all can receive call request, solve the nonsynchronous problem of each extension set state in the communication terminal.The resource that the method need to take is little, is particularly suitable for embedded device.
Wherein, in step S50, the communications status that caller equipment receives by analysis judges whether the other side answers.For example, if the communications status that extension set is replied is " in conversing with the equipment of certain IP address ", certain IP address wherein is the third-party IP address with its conversation, like this caller equipment namely know this extension set be in third party conversation in can't connect again end of calling with oneself.After having extension set to answer, extension set has namely been set up conversation with caller equipment and has been connected, and this moment, the communications status of extension set became and caller equipment talking state, and caller equipment namely carries out respective handling after receiving this communications status, with the one to one conversation of foundation with this extension set.Other situation also is corresponding processing.
Also consult simultaneously Fig. 3 in conjunction with Fig. 2, particularly, caller equipment is set up and the process of the man-to-man conversation of extension set comprises step:
S51: the communications status of self is set to converse, and adds the IP address of connecting extension set in communications status; This IP address mainly is the identity for this connection extension set of expression;
S52: self communications status form with the UDP bag is sent to each extension set; The transmission object of this moment still is a plurality of extension sets, all the IP addresses in the IP address list that namely obtains among the step S20;
S53: receive the communications status that each extension set is replied with the UDP packet form, judge whether each extension set is hung up, no longer send communications status to this extension set if hang up then; If do not hang up, then continue to send self communications status until all hang up except connecting other extension sets of extension set to this extension set, thereby then only send communications status and this extension set and set up one to one and converse to connecting extension set.In this step, it is the processing that the control module of extension set self is taked according to the communications status of the caller equipment that receives that the extension set of access failure is hung up, and can preset by software program.
Setting up in the process of one to one conversation at this, still adopt the communication of state-based to make other extension set automatically withdraw from conversation, and finally set up man-to-man conversation, is point-to-point communication in communication process, avoids asynchronous problem.Preferably, after setting up one to one conversation with extension set, send self communications status until end of conversation with predetermined space to this extension set.In this manner, communication is to continue the interval operation, can regard heartbeat function as, omits the communication heartbeat packet, and need not to worry UDP packet loss problem, can automatically recover when sending communications status next time, guarantees the state synchronized of both call sides.
Above-mentioned method is the processing mode of calling out to the communication terminal with a plurality of extension sets, and for the communication terminal with a plurality of extension sets, when it was called out to other communication terminal as caller equipment, each extension set can be used as independently equipment and calls out.This communication terminal with a plurality of extension sets is during as called equipment, and whether parallel sessions can be set according to the actual requirements between its extension set.Still take building conversational system as example, resident family's machine is as a communication terminal, and it has a plurality of extension sets, and actual demand is for when an extension set is in talking state, and other extension sets no longer can be conversed with other communication terminals; For administrative center, have equally a plurality of extension sets, actual demand is for when an extension set is in talking state, and other extension sets still can receive new incoming call.For these two kinds of demands, realize by the difference setting to extension set.
For resident family's machine, when wherein an extension set is in the conversation, if receive again new call request (the communications status UDP bag that new caller equipment sends), the extension set of then conversing is replied the communications status of oneself in conversing with so-and-so equipment, caller this moment equipment receives communications status, judges then end of calling of this extension set access failure.
For administrative center, similarly, when wherein an extension set was in the conversation, if receive again new call request (the communications status UDP bag that new caller equipment sends), the extension set of then conversing was not replied communications status, is equivalent to stealthy state; And other idle extension sets are replied communications status, and then caller equipment is made corresponding judgement and processing after receiving communications status.
Consult Fig. 3, the present invention also proposes a kind of communication equipment that can communicate by letter with the communication terminal with a plurality of extension sets, comprising:
Calling unit 1 is for the number of calling out described communication terminal;
IP address acquisition unit 2 is for the IP address list that obtains these all extension sets of communication terminal according to the number of communication terminal;
Communications status transmitting element 3 is used for to the communications status of all IP addresses transmissions self of IP address list, and wherein, communications status is packaged in the UDP bag;
Communications status receiving element 4 is used for the communications status of this extension set that each extension set of received communication terminal replys, and wherein, communications status is packaged in the UDP bag;
Communications status processing unit 5 is used for analyzing and processing and responds the communications status of this extension set that each extension set replys.
Wherein, the concrete course of work of described communications status processing unit 5 is: if the communications status that one or more extension set is replied for conversing with third party device, end of calling then; If the communications status that extension set is replied at jingle bell, waits for then that extension set answers for just, if extension set ring unanswered or a wherein extension set rejection in the scheduled time, then end of calling if wherein an extension set is answered, is then set up one to one with this extension set and is conversed.
Wherein, described communications status processing unit 5 communications status of self after having extension set to answer is set to converse, and adds the IP address of connecting extension set in communications status, and this communications status is transferred to described communications status transmitting element 3 transmissions.
This equipment also further comprises:
Judging unit 6 is used for judging whether to obtain successfully when obtaining IP address list, then points out end of calling if obtain failure, successfully then triggers described communications status transmitting element 3 work if obtain.
This equipment also further comprises:
Timing unit 7 is used for timing after described communications status transmitting element 3 sends communications status, if described communications status receiving element 4 does not receive that the answer of any extension set then points out end of calling in the given time.
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 do; 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.