Disclosure of Invention
The invention provides a method and a system for releasing a temporary destination node, which are used for realizing the release of the temporary destination node.
In order to achieve the above object, the present invention provides a method for releasing a temporary termination point, including:
when the media gateway starts to receive and transmit RTP stream, a timer is started;
the media gateway counts the number of the RTP streams;
after the timer is overtime, the media gateway judges that the counted number of the transmitting and receiving RTP streams is equal to 0 or more than 0;
if the media gateway judges that the number of the RTP streams is equal to 0, determining that the temporary destination node is abnormal;
and the media gateway releases the temporary termination point.
Optionally, before the releasing the temporary termination point of the context information, the media gateway further includes:
the media gateway sends query information to a media gateway controller, wherein the query information comprises context information of a temporary termination point;
the media gateway controller inquires whether the context information is stored;
and if the media gateway controller inquires that the context information is not stored, returning context error information to the media gateway.
Optionally, if the media gateway determines that the number of the RTP streams to be received and transmitted is greater than 0, the media gateway starts a timer and continues to perform the step of counting the number of the RTP streams to be received and transmitted by the media gateway.
Optionally, when starting to receive and send an RTP stream, the media gateway further includes, before starting the timer:
the media gateway counts the call duration of all calls in a set time period in advance, and determines the minimum call duration from the call durations of all calls;
and the media gateway sets the minimum call duration as the duration of the timer.
Optionally, if the media gateway determines that the number of the RTP streams sent and received is equal to 0, the method further includes, after determining that the temporary destination node is abnormal:
the media gateway inquires whether the call ending information sent by the media gateway controller is received;
if the media gateway inquires that the call ending information sent by the media gateway controller is not received, the step that the media gateway sends inquiry information to the media gateway controller is continuously executed;
and if the media gateway inquires that the call ending information sent by the media gateway controller is received, continuing to execute the step of releasing the temporary destination node by the media gateway.
To achieve the above object, the present invention provides a system for releasing a temporary termination point, including: a media gateway;
the media gateway is used for starting a timer when starting to receive and transmit RTP stream; counting the number of the RTP streams; when the timer is overtime, judging that the counted number of the transmitting and receiving RTP streams is equal to 0 or greater than 0; if the number of the RTP streams is judged to be equal to 0, determining that the temporary termination point is abnormal; releasing the temporary termination point.
Optionally, the method further comprises:
the media gateway is also used for sending query information to the media gateway controller, wherein the query information comprises the context information of the temporary termination point;
the media gateway controller is used for inquiring whether the context information is stored; and if the context information is not stored, returning context error information to the media gateway.
Optionally, the media gateway is further configured to start a timer if it is determined that the number of the RTP streams to be received and sent is greater than 0, and continue to perform the step of counting the number of the RTP streams to be received and sent by the media gateway.
Optionally, the media gateway is further configured to count call durations of all calls within a set time period in advance, and determine a minimum call duration from the call durations of all calls; and setting the minimum call duration as the duration of the timer.
Optionally, the media gateway is further configured to query whether call end information sent by the media gateway controller is received; if the call end information sent by the media gateway controller is not received, the step of sending the query information to the media gateway controller is continuously executed; and if the call ending information sent by the media gateway controller is inquired and received, continuing to execute the step of releasing the temporary destination node.
The invention has the following beneficial effects:
in the technical scheme of the method and the system for releasing the temporary destination provided by the invention, after the timer is overtime, if the number of the RTP streams is judged to be equal to 0, the media gateway determines that the temporary destination is abnormal and releases the temporary destination, so that the release of the temporary destination is realized.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the method and system for releasing the temporary termination point provided by the present invention are described in detail below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a method for releasing a temporary termination point according to an embodiment of the present invention, as shown in fig. 1, the method includes:
step 101, when the media gateway starts to receive and transmit the RTP stream, a timer is started.
Step 102, the media gateway counts the number of the RTP streams.
Step 103, after the timer is overtime, the media gateway judges that the counted number of the transmitting and receiving RTP streams is equal to 0 or larger than 0, if so, the step 104 is executed; if so, go to step 106.
And step 104, the media gateway determines that the temporary termination point is abnormal.
Step 105, the media gateway releases the temporary termination point, and the process is ended.
Step 106, the media gateway starts the timer and continues to execute step 101.
In the technical scheme of the method for releasing the temporary destination node provided in this embodiment, after the timer expires, if it is determined that the number of the RTP streams received and sent is equal to 0, the media gateway determines that the temporary destination node is abnormal, and releases the temporary destination node.
Fig. 2 is a flowchart of a method for releasing a temporary termination point according to a second embodiment of the present invention, as shown in fig. 2, the method includes:
step 201, the media gateway counts the call duration of all calls within a set time period in advance, and determines the minimum call duration from the call durations of all calls.
In this embodiment, the set time period may be set as needed.
Step 202, the media gateway sets the minimum call duration as the duration of the timer.
Step 203, the media gateway starts a timer when starting to transmit and receive the RTP stream.
When a call is established, the media gateway starts to receive and transmit RTP stream. Wherein, the receiving and sending the RTP stream comprises receiving the RTP stream and/or sending the RTP stream. A timer is started when the media gateway starts receiving or sending RTP streams.
Step 204, the media gateway counts the number of the RTP streams to be transmitted and received.
In this embodiment, the number of transceiving RTP streams is equal to the sum of the number of receiving RTP streams and the number of transmitting RTP streams. The media gateway starts counting the number of the RTP streams from the start of the timer until the timer expires.
Step 205, after the timer is overtime, the media gateway judges that the counted number of the transmitting and receiving RTP streams is equal to 0 or greater than 0, if the counted number of the transmitting and receiving RTP streams is greater than 0, the step 206 is executed; if equal to 0, go to step 207.
When the media gateway judges that the counted number of the RTP streams for receiving and sending is equal to 0, the media gateway indicates that the media gateway does not send the RTP streams and does not receive the RTP streams during the working period of the timer.
And when the media gateway judges that the counted number of the RTP streams for receiving and transmitting is greater than 0, the media gateway is indicated to transmit the RTP streams and/or receive the RTP streams during the working period of the timer.
Step 206, the media gateway starts a timer and continues to execute step 204.
And when the counted number of the transmitting and receiving RTP streams is judged to be more than 0, the media gateway restarts the timer.
Step 207, the media gateway determines that the temporary termination point is abnormal.
Step 208, the media gateway queries whether the call ending information sent by the media gateway controller is received, if not, step 209 is executed; if yes, go to step 212.
When the call is over, the media gateway controller will send the call over information to the media gateway to inform the media gateway of the call over. Therefore, the media gateway can inquire whether the call ending information sent by the media gateway controller is received, when the media gateway inquires that the call ending information is received, the call ending is indicated, and when the media gateway inquires that the call ending information is not received, the call ending is indicated.
Step 209, the media gateway sends query information to the media gateway controller, where the query information includes context information where the temporary termination point is located.
Step 210, the media gateway controller inquires whether the context information is stored, if not, step 211 is executed; if yes, go to step 213.
The media gateway inquires whether the context information stored by the media gateway is consistent with the context information in the received inquiry information, if so, the media gateway controller is indicated to store the context information; if not, it indicates that the media gateway controller does not store the context information.
Step 211, the media gateway controller returns the context error information to the media gateway.
Step 212, the media gateway releases the temporary termination point, and the process ends.
Step 213, the media gateway controller returns the context normal information to the media gateway, and continues to execute step 206.
In the technical scheme of the method for releasing the temporary destination node provided in this embodiment, after the timer expires, if it is determined that the number of the RTP streams received and sent is equal to 0, the media gateway determines that the temporary destination node is abnormal, and releases the temporary destination node.
Fig. 3 is a schematic structural diagram of a release system of a temporary termination point according to a third embodiment of the present invention, as shown in fig. 3, the system includes: a media gateway 1.
The media gateway 1 is used for starting a timer when starting to receive and transmit RTP stream; counting the number of the RTP streams; when the timer is overtime, judging that the counted number of the transmitting and receiving RTP streams is equal to 0 or greater than 0; if the number of the RTP streams is judged to be equal to 0, determining that the temporary termination point is abnormal; releasing the temporary termination point.
Further, the system further comprises: a media gateway controller 2. The media gateway 1 is further configured to send query information to the media gateway controller, where the query information includes context information where the temporary termination point is located; the media gateway controller 2 is used for inquiring whether the context information is stored; and if the context information is not stored, returning the context error information to the media gateway 1.
Further, the media gateway 1 is further configured to start a timer if it is determined that the number of the RTP streams to be received and sent is greater than 0, and continue to perform the step of counting the number of the RTP streams to be received and sent by the media gateway.
Further, the media gateway 1 is further configured to count the call durations of all calls in a preset time period in advance, and determine a minimum call duration from the call durations of all calls; and setting the minimum call duration as the duration of the timer.
Further, the media gateway 1 is further configured to query whether call ending information sent by the media gateway controller is received; if the call end information sent by the media gateway controller is not received, the step of sending the query information to the media gateway controller is continuously executed; if the call end information sent by the media gateway controller is inquired and received, the step of releasing the temporary termination point of the context information is continuously executed.
The system for releasing a temporary destination provided in this embodiment is used to implement the method for releasing a temporary destination provided in the first embodiment or the second embodiment.
In the technical scheme of the system for releasing a temporary destination provided in this embodiment, after the timer expires, if it is determined that the number of the RTP streams received and sent is equal to 0, the media gateway determines that the temporary destination is abnormal, and releases the temporary destination.
It will be understood that the above embodiments are merely exemplary embodiments taken to illustrate the principles of the present invention, which is not limited thereto. It will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the spirit and substance of the invention, and these modifications and improvements are also considered to be within the scope of the invention.