CN116455877A - Data interaction method, device and equipment - Google Patents
Data interaction method, device and equipment Download PDFInfo
- Publication number
- CN116455877A CN116455877A CN202310453075.4A CN202310453075A CN116455877A CN 116455877 A CN116455877 A CN 116455877A CN 202310453075 A CN202310453075 A CN 202310453075A CN 116455877 A CN116455877 A CN 116455877A
- Authority
- CN
- China
- Prior art keywords
- terminal
- port
- information
- data
- server
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000003993 interaction Effects 0.000 title claims abstract description 96
- 238000000034 method Methods 0.000 title claims abstract description 74
- 238000012545 processing Methods 0.000 claims description 29
- 230000004044 response Effects 0.000 claims description 27
- 238000004891 communication Methods 0.000 abstract description 9
- 230000011664 signaling Effects 0.000 description 24
- 230000005540 biological transmission Effects 0.000 description 23
- 238000010586 diagram Methods 0.000 description 11
- 230000006870 function Effects 0.000 description 10
- 230000001360 synchronised effect Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 238000012790 confirmation Methods 0.000 description 3
- 238000004590 computer program Methods 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 241000699670 Mus sp. Species 0.000 description 1
- 230000006378 damage Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/1066—Session management
- H04L65/1069—Session establishment or de-establishment
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/1066—Session management
- H04L65/1101—Session protocols
- H04L65/1104—Session initiation protocol [SIP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/80—Responding to QoS
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Mobile Radio Communication Systems (AREA)
- Telephonic Communication Services (AREA)
Abstract
Description
技术领域technical field
本申请属于通信技术领域,具体涉及一种数据交互方法、装置和设备。The present application belongs to the technical field of communication, and in particular relates to a data interaction method, device and equipment.
背景技术Background technique
随着通信技术的发展,人们越来越多地选择通过音视频通话的方式进行沟通交流。With the development of communication technology, people increasingly choose to communicate through audio and video calls.
目前,两个终端之间进行音视频通话,需要经过流媒体服务器进行数据的处理和转发,而任意两个终端之间进行通话时都需要流媒体服务器提供专门的端口,以实现在任意两个终端之间进行数据交互,因此,流媒体服务器提供的端口的数量需要与通话终端的数量相同,这样导致占用大量流媒体服务器端口资源,而由于流媒体服务器端口资源有限,每个通话占用一些专用端口的模式极大地制约了流媒体服务器可支撑的最大终端连接数。At present, the audio and video calls between two terminals need to be processed and forwarded by the streaming media server, and the streaming media server needs to provide a dedicated port for any two terminals to communicate between any two terminals. Data interaction between terminals, therefore, the number of ports provided by the streaming media server needs to be the same as the number of call terminals, which leads to the occupation of a large number of streaming media server port resources, and due to the limited streaming media server port resources, each call occupies some dedicated The port mode greatly restricts the maximum number of terminal connections that the streaming server can support.
发明内容Contents of the invention
本申请实施例的目的是提供一种数据交互方法、装置、设备和存储介质,能够节约公网端口资源,提高服务器可支撑的终端最大连接数。The purpose of the embodiments of the present application is to provide a data interaction method, device, device, and storage medium, which can save public network port resources and increase the maximum number of terminal connections that a server can support.
第一方面,本申请实施例提供了一种数据交互方法,应用于服务器,该方法包括:In the first aspect, the embodiment of the present application provides a data interaction method applied to a server, and the method includes:
接收第一终端发送的第一信息,以及第二终端发送的第二信息,其中,所述第一信息中包括所述第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息,所述第二信息中包括所述第二终端对应的第二终端标识、第二目的终端标识和第二端口对应的端口信息;receiving the first information sent by the first terminal and the second information sent by the second terminal, wherein the first information includes the first terminal identifier corresponding to the first terminal, the first destination terminal identifier and the first port Corresponding port information, where the second information includes a second terminal identifier corresponding to the second terminal, a second destination terminal identifier, and port information corresponding to the second port;
在所述第一目的终端标识与所述第二终端标识相匹配,且所述第二目的终端标识和所述第一终端标识相匹配的情况下,基于所述第一端口对应的端口信息和所述第二端口对应的端口信息,建立所述第一端口和所述第二端口之间的关联关系;If the first destination terminal identifier matches the second terminal identifier, and the second destination terminal identifier matches the first terminal identifier, based on the port information corresponding to the first port and the Port information corresponding to the second port, establishing an association relationship between the first port and the second port;
根据所述关联关系,在所述第一终端和所述第二终端之间进行数据交互。Data interaction is performed between the first terminal and the second terminal according to the association relationship.
第二方面,本申请实施例提供了一种数据交互方法,应用于第一终端,该方法包括:In the second aspect, the embodiment of the present application provides a data interaction method, which is applied to the first terminal, and the method includes:
获取与第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息;Obtaining a first terminal identifier corresponding to the first terminal, a first destination terminal identifier, and port information corresponding to the first port;
向服务器发送包括所述第一终端标识、所述第一目的终端标识和所述第一端口对应的端口信息的第一信息,以使所述服务器根据所述第一信息和第二终端发送的第二信息,建立所述第一端口和所述第二终端的第二端口之间的关联关系;Sending first information including the first terminal identifier, the first destination terminal identifier, and port information corresponding to the first port to the server, so that the server sends the first information based on the first information and the second terminal second information, establishing an association relationship between the first port and the second port of the second terminal;
基于所述关联关系,通过所述服务器与所述第二终端进行数据交互。Based on the association relationship, perform data interaction with the second terminal through the server.
第三方面,本申请实施例提供了一种数据交互装置,应用于服务器,该装置包括:In the third aspect, the embodiment of the present application provides a data interaction device, which is applied to a server, and the device includes:
信息接收模块,用于接收第一终端发送的第一信息,以及第二终端发送的第二信息,其中,所述第一信息中包括所述第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息,所述第二信息中包括所述第二终端对应的第二终端标识、第二目的终端标识和第二端口对应的端口信息;An information receiving module, configured to receive first information sent by the first terminal and second information sent by the second terminal, wherein the first information includes the first terminal identifier corresponding to the first terminal, the first purpose a terminal identifier and port information corresponding to the first port, where the second information includes a second terminal identifier corresponding to the second terminal, a second destination terminal identifier, and port information corresponding to the second port;
关系建立模块,用于在所述第一目的终端标识与所述第二终端标识相匹配,且所述第二目的终端标识和所述第一终端标识相匹配的情况下,基于所述第一端口对应的端口信息和所述第二端口对应的端口信息,建立所述第一端口和所述第二端口之间的关联关系;a relationship establishing module, configured to, in the case that the first destination terminal identifier matches the second terminal identifier, and the second destination terminal identifier matches the first Port information corresponding to the port and port information corresponding to the second port, establishing an association relationship between the first port and the second port;
数据交互模块,用于根据所述关联关系,在所述第一终端和所述第二终端之间进行数据交互。A data interaction module, configured to perform data interaction between the first terminal and the second terminal according to the association relationship.
第四方面,本申请实施例提供了一种数据交互装置,应用于第一终端,该装置包括:In a fourth aspect, the embodiment of the present application provides a data interaction device, which is applied to a first terminal, and the device includes:
信息获取模块,用于获取与第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息;An information acquisition module, configured to acquire a first terminal identifier corresponding to the first terminal, a first destination terminal identifier, and port information corresponding to the first port;
信息发送模块,用于向服务器发送包括所述第一终端标识、所述第一目的终端标识和所述第一端口对应的端口信息的第一信息,以使所述服务器根据所述第一信息和第二终端发送的第二信息,建立所述第一端口和所述第二终端的第二端口之间的关联关系;an information sending module, configured to send to a server first information including the first terminal identifier, the first destination terminal identifier, and port information corresponding to the first port, so that the server establishing an association relationship between the first port and the second port of the second terminal with the second information sent by the second terminal;
信息交互模块,用于基于所述关联关系,通过所述服务器与所述第二终端进行数据交互。An information interaction module, configured to perform data interaction with the second terminal through the server based on the association relationship.
第五方面,本申请实施例提供了一种电子设备,该电子设备包括处理器和存储器,所述存储器存储可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如第一方面或第二方面所述的方法的步骤。In the fifth aspect, the embodiment of the present application provides an electronic device, the electronic device includes a processor and a memory, the memory stores programs or instructions that can run on the processor, and the programs or instructions are processed by the implement the steps of the method described in the first aspect or the second aspect when executed by a device.
第六方面,本申请实施例提供了一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如第一方面或第二方面所述的方法的步骤。In the sixth aspect, the embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the implementation as described in the first aspect or the second aspect is realized. steps of the method.
第七方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面或第二方面所述的方法。In the seventh aspect, the embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions, so as to implement the first aspect Or the method described in the second aspect.
第八方面,本申请实施例提供一种计算机程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如第一方面或第二方面所述的方法。In an eighth aspect, an embodiment of the present application provides a computer program product, the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the method described in the first aspect or the second aspect.
在本申请实施例中,通过设置数据转发服务,接收第一终端发送的第一信息,以及第二终端发送的第二信息,在第一信息中的第一目的终端标识与第二信息中的第二终端标识相匹配,且第二信息中的第二目的终端标识与第一信息中的第一终端标识相匹配的情况下,在第一终端提供的第一端口和第二终端提供的第二端口之间建立关联关系,并利用该关联关系,进行数据转发,实现第一终端和第二终端之间的数据交互。这样,服务器无需再为每对终端都提供专用的数据传输端口,而只需提供公网的一个端口,通过该端口接收终端需要传输的数据,并基于终端端口之间的关联关系进行数据转发,即可实现任意两个终端之间的数据传输,实现了公网端口的复用,节省了公网的端口资源,提高了服务器所能支撑的终端最大连接数。In this embodiment of the application, by setting up the data forwarding service, the first information sent by the first terminal and the second information sent by the second terminal are received. When the second terminal ID matches, and the second destination terminal ID in the second information matches the first terminal ID in the first information, the first port provided by the first terminal and the second terminal provided by the second terminal An association relationship is established between the two ports, and data forwarding is performed using the association relationship, so as to realize data interaction between the first terminal and the second terminal. In this way, the server no longer needs to provide a dedicated data transmission port for each pair of terminals, but only needs to provide a port on the public network, through which the data that the terminal needs to transmit is received, and the data is forwarded based on the association relationship between the terminal ports. It can realize data transmission between any two terminals, realize the multiplexing of public network ports, save the port resources of the public network, and increase the maximum number of terminal connections that the server can support.
附图说明Description of drawings
图1是相关技术中的数据交互方法所适应的架构示意图;FIG. 1 is a schematic diagram of an architecture adapted to a data interaction method in the related art;
图2是本申请实施例提供的数据交互方法所适应的架构示意图;FIG. 2 is a schematic diagram of the architecture adapted to the data interaction method provided by the embodiment of the present application;
图3是本申请一个实施例提供的数据交互方法的流程图;FIG. 3 is a flowchart of a data interaction method provided by an embodiment of the present application;
图4是本申请一个实施例提供的数据交互方法的流程图;FIG. 4 is a flowchart of a data interaction method provided by an embodiment of the present application;
图5是本申请一个实施例提供的数据交互装置的结构框图;Fig. 5 is a structural block diagram of a data interaction device provided by an embodiment of the present application;
图6是本申请一个实施例提供的数据交互装置的结构框图;Fig. 6 is a structural block diagram of a data interaction device provided by an embodiment of the present application;
图7是本申请一个实施例提供的电子设备的结构框图;Fig. 7 is a structural block diagram of an electronic device provided by an embodiment of the present application;
图8为实现本申请实施例的一种电子设备的硬件结构示意图。FIG. 8 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员获得的所有其他实施例,都属于本申请保护的范围。The following will clearly describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of them. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in this application belong to the protection scope of this application.
本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。The terms "first", "second" and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific sequence or sequence. It should be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application can be practiced in sequences other than those illustrated or described herein, and that references to "first," "second," etc. distinguish Objects are generally of one type, and the number of objects is not limited. For example, there may be one or more first objects. In addition, "and/or" in the specification and claims means at least one of the connected objects, and the character "/" generally means that the related objects are an "or" relationship.
下面首先对本申请可能涉及的技术专有名词进行解释:The technical terms that may be involved in this application are firstly explained below:
RTP(Realtime Transport Protocol,实时传输协议):RTP标准定义了两个子协议,RTP和RTCP(Realtime Transport Control Protocol,实时传输控制协议),用于在单播或多播网络中传送音频、视频等实时数据流,主要通过一个网络地址和一对端口来进行传输协议报文。一个用于媒体数据流,另一个用于控制数据流。RTP (Realtime Transport Protocol, Real-time Transport Protocol): The RTP standard defines two sub-protocols, RTP and RTCP (Realtime Transport Control Protocol, Real-time Transport Control Protocol), which are used to transmit real-time audio, video, etc. in unicast or multicast networks. The data flow mainly transmits the protocol message through a network address and a pair of ports. One is for media data flow and the other is for control data flow.
SIP(Session Initiation Protocol,会话初始化协议):主要用于流媒体会话中信令的交互,控制整个会话的建立、呼叫、更新和销毁等。SIP (Session Initiation Protocol, Session Initiation Protocol): It is mainly used for signaling interaction in a streaming media session, and controls the establishment, call, update, and destruction of the entire session.
SDP(Session Description Protocol,会话描述协议):主要用于协商终端之间媒体流的相关配置参数信息,常作为信令协议的消息体随信令转达至对端。SDP (Session Description Protocol, Session Description Protocol): It is mainly used to negotiate the relevant configuration parameter information of the media stream between terminals, and is often used as the message body of the signaling protocol to be conveyed to the opposite end along with the signaling.
ACK(Acknowledge character,确认字符):在数据通信中,数据接收端发给数据发送端的一种传输类控制字符。表示发来的数据已确认接收无误。ACK (Acknowledge character, confirmation character): In data communication, a transmission type control character sent by the data receiving end to the data sending end. Indicates that the incoming data has been confirmed to be received without error.
目前,两个终端之间进行音视频通话,均需要经过流媒体服务器进行数据的处理和转发,而流媒体服务系统采用的是SDP来协商音视频参数信息,因此,共需要占用四个端口,其中音频占用两个端口,分别传输音频流(也即音频RTP)和对应控制包(也即音频RTCP),视频同样占用两个端口,分别传输视频流(也即视频RTP)和对应控制包(也即视频RTCP)。At present, audio and video calls between two terminals need to be processed and forwarded by the streaming media server, and the streaming media service system uses SDP to negotiate audio and video parameter information. Therefore, a total of four ports are required. Among them, audio occupies two ports, respectively transmits audio stream (that is, audio RTP) and corresponding control packet (that is, audio RTCP), and video also occupies two ports, respectively transmits video stream (that is, video RTP) and corresponding control packet ( Also known as video RTCP).
如图1所示,当两个终端之间进行通话时,终端11和流媒体服务器12需要建立一个RTP会话,终端11也将确定一对目的传输地址。目的传输地址由一个网络地址和四个端口组成,这四个端口中两个用于传输音频RTP数据包和音频RTCP数据包,两个用于传输视频RTP数据包和视频RTCP数据包。As shown in FIG. 1 , when a call is made between two terminals, the terminal 11 and the streaming media server 12 need to establish an RTP session, and the terminal 11 will also determine a pair of destination transmission addresses. The destination transmission address consists of a network address and four ports, two of which are used to transmit audio RTP data packets and audio RTCP data packets, and two are used to transmit video RTP data packets and video RTCP data packets.
也就是说,任意两个终端之间进行通话时都需要流媒体服务器提供专门的端口,以实现在任意两个终端之间进行数据交互。例如一个通话需要占用流媒体服务器中的四个端口,两个通话则需要占用流媒体服务器中的八个端口,以此类推,有多少对终端进行通话,流媒体服务器就需要提供多少组端口,这样导致占用大量公网端口资源,而由于服务器端口资源有限,每个通话占用一些专用端口的模式极大地制约了流媒体服务器可支撑的最大终端连接数。That is to say, when a call is made between any two terminals, a special port is required to be provided by the streaming media server, so as to realize data exchange between any two terminals. For example, one call needs to occupy four ports in the streaming media server, two calls need to occupy eight ports in the streaming media server, and so on, as many pairs of terminals are used for calls, the streaming media server needs to provide as many ports as possible. This leads to the occupation of a large number of public network port resources, and due to the limited server port resources, the mode of occupying some dedicated ports for each call greatly restricts the maximum number of terminal connections that the streaming media server can support.
为了解决上述技术问题,本申请提供了一种数据交互方法、装置、设备和存储介质。其中,本申请所提供的数据交互方法可以应用于如图2所示的架构中,具体结合图2进行详细说明。In order to solve the above technical problems, the present application provides a data interaction method, device, device and storage medium. Wherein, the data interaction method provided by the present application can be applied to the architecture shown in FIG. 2 , which will be described in detail in conjunction with FIG. 2 .
图2是本申请实施例提供的数据交互方法所适应的架构示意图。FIG. 2 is a schematic diagram of an architecture adapted to the data interaction method provided by the embodiment of the present application.
如图2所示,该架构图中可以包括第一终端21、第二终端22、信令服务器23、流媒体服务器24和媒体转发服务器25。其中,第一终端21和第二终端22可以是手机、电脑等任意终端设备,在该架构中,除了第一终端21和第二终端22这两个终端之外,还可包括其他多个终端(图2中未示出),在此不作限定。另外,信令服务器23可以是流媒体服务系统中用于接收和转发SIP信令的服务器,流媒体服务器24可以是流媒体服务系统中用于控制终端通话和处理通话数据的服务器,媒体转发服务器25是本申请实施例中设置的用于在任意两个终端之间进行数据转发的服务器。As shown in FIG. 2 , the architecture diagram may include a first terminal 21 , a second terminal 22 , a signaling server 23 , a streaming media server 24 and a media forwarding server 25 . Wherein, the first terminal 21 and the second terminal 22 can be any terminal devices such as mobile phones and computers. In this framework, in addition to the two terminals of the first terminal 21 and the second terminal 22, other multiple terminals can also be included. (not shown in FIG. 2 ), it is not limited here. In addition, the signaling server 23 can be a server for receiving and forwarding SIP signaling in the streaming media service system, and the streaming media server 24 can be a server for controlling terminal calls and processing call data in the streaming media service system. 25 is a server configured in the embodiment of the present application for data forwarding between any two terminals.
示例性地,在第一终端21呼叫第二终端22,或第二终端22呼叫第一终端21之前,第一终端21需要通过SIP信令向信令服务器23发送第一终端21的注册登记信息,信令服务器23把收到的注册登记信息转发至流媒体服务器24,流媒体服务器24对第一终端21的注册登记信息进行处理,并登记第一终端21上线。第二终端22同理,也需要通过向信令服务器23发送SIP信令,进行注册登记。Exemplarily, before the first terminal 21 calls the second terminal 22, or the second terminal 22 calls the first terminal 21, the first terminal 21 needs to send the registration information of the first terminal 21 to the signaling server 23 through SIP signaling , the signaling server 23 forwards the received registration information to the streaming media server 24, and the streaming media server 24 processes the registration information of the first terminal 21 and registers the first terminal 21 to go online. Similarly, the second terminal 22 also needs to register by sending SIP signaling to the signaling server 23 .
基于上述架构,下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的数据交互方法进行详细地说明。Based on the above architecture, the data interaction method provided by the embodiment of the present application will be described in detail below through specific embodiments and application scenarios with reference to the accompanying drawings.
需要说明的是,本申请实施例提供的数据交互方法,执行主体可以为数据交互装置。本申请实施例中以数据交互装置执行数据交互方法为例,说明本申请实施例提供的数据交互方法。It should be noted that, the data interaction method provided in the embodiment of the present application may be executed by a data interaction device. In the embodiment of the present application, the data interaction method performed by the data interaction device is taken as an example to illustrate the data interaction method provided in the embodiment of the present application.
图3是本申请一个实施例提供的数据交互方法的流程图。该数据交互方法可应用于服务器,例如上述图2中的媒体转发服务器25。Fig. 3 is a flowchart of a data interaction method provided by an embodiment of the present application. This data interaction method can be applied to a server, such as the media forwarding server 25 in FIG. 2 above.
如图3所示,该数据交互方法可以包括步骤:S310-S340,下面进行具体说明。As shown in FIG. 3, the data interaction method may include steps: S310-S340, which will be described in detail below.
S310,接收第一终端发送的第一信息,以及第二终端发送的第二信息,其中,第一信息中包括第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息,第二信息中包括第二终端对应的第二终端标识、第二目的终端标识和第二端口对应的端口信息。S310. Receive the first information sent by the first terminal and the second information sent by the second terminal, where the first information includes the first terminal identifier corresponding to the first terminal, the first destination terminal identifier, and the first terminal identifier corresponding to the first port. Port information, where the second information includes a second terminal identifier corresponding to the second terminal, a second destination terminal identifier, and port information corresponding to the second port.
本申请实施例中,在第一终端与第二终端正式进行数据交互之前,媒体转发服务器可先接收第一终端发送的第一信息和第二终端发送的第二信息。其中,该第一信息和第二信息可以是以RTP扩展报文的形式发送至媒体转发服务器。In the embodiment of the present application, before the first terminal and the second terminal formally perform data interaction, the media forwarding server may first receive the first information sent by the first terminal and the second information sent by the second terminal. Wherein, the first information and the second information may be sent to the media forwarding server in the form of an RTP extended message.
这里,第一信息可以包括第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息,第二信息可以包括第二终端对应的第二终端标识、第二目的终端标识和第二端口对应的端口信息。其中,第一终端标识可以是能够唯一标记第一终端的标识。第一目的终端标识可以是第一终端需要通话的目的终端的唯一标识。同理,第二终端标识可以是能够唯一标记第二终端的标识。第二目的终端标识可以是第二终端需要通话的目的终端的唯一标识。其中,终端标识例如可以是手机号码、MAC(Media Access Control,媒体访问控制)地址等。Here, the first information may include the first terminal identifier corresponding to the first terminal, the first destination terminal identifier, and port information corresponding to the first port, and the second information may include the second terminal identifier corresponding to the second terminal, the second destination terminal Port information corresponding to the second port is identified. Wherein, the first terminal identifier may be an identifier capable of uniquely marking the first terminal. The first destination terminal identifier may be a unique identifier of the destination terminal that the first terminal needs to talk to. Similarly, the second terminal identifier may be an identifier capable of uniquely marking the second terminal. The second destination terminal identifier may be a unique identifier of the destination terminal that the second terminal needs to talk to. Wherein, the terminal identifier may be, for example, a mobile phone number, a MAC (Media Access Control, Media Access Control) address, and the like.
另外,第一端口为第一终端中被配置于用于进行数据交互的端口,第二端口为第二终端中被配置于用于进行数据交互的端口。端口信息例如可以是端口号等。In addition, the first port is a port configured for data interaction in the first terminal, and the second port is a port configured for data interaction in the second terminal. The port information may be, for example, a port number or the like.
在一些实施方式中,第一端口可以包括第一音频端口和第一视频端口,第二端口可以包括第二音频端口和第二视频端口。其中,第一音频端口和第二音频端口例如可以是音频RTP端口,用于发送和接收音频RTP/RTCP数据。第一视频端口和第二视频端口例如可以是视频RTP端口,用于发送和接收视频RTP/RTCP数据。In some implementations, the first port may include a first audio port and a first video port, and the second port may include a second audio port and a second video port. Wherein, the first audio port and the second audio port may be, for example, audio RTP ports, for sending and receiving audio RTP/RTCP data. The first video port and the second video port may be, for example, video RTP ports for sending and receiving video RTP/RTCP data.
当然,在仅进行音频或视频通话时,第一端口和第二端口也可以仅包括其中一种类型的端口,在此不作限定。Of course, when only audio or video calls are made, the first port and the second port may also include only one type of port, which is not limited here.
示例性地,如图2所示,在第一终端21和第二终端22互相发送音视频数据之前,第一终端21率先把自身终端标识、目的终端标识、自身的音频RTP端口信息、视频RTP端口信息等,通过RTP扩展报文发送至媒体转发服务器25。媒体转发服务器25将第一终端21发来的RTP扩展报文进行解析并登记。第二终端22同理,媒体转发服务25在收到第二终端22发送的RTP扩展报文后,也进行解析并登记。Exemplarily, as shown in FIG. 2, before the first terminal 21 and the second terminal 22 send audio and video data to each other, the first terminal 21 first transmits its own terminal ID, destination terminal ID, its own audio RTP port information, video RTP The port information and the like are sent to the media forwarding server 25 through the RTP extended message. The media forwarding server 25 parses and registers the RTP extended message sent by the first terminal 21 . The same is true for the second terminal 22 , and the media forwarding service 25 also parses and registers after receiving the RTP extension message sent by the second terminal 22 .
S320,在第一目的终端标识与第二终端标识相匹配,且第二目的终端标识和第一终端标识相匹配的情况下,基于第一端口对应的端口信息和第二端口对应的端口信息,建立第一端口和第二端口之间的关联关系。S320. When the first destination terminal identifier matches the second terminal identifier, and the second destination terminal identifier matches the first terminal identifier, based on the port information corresponding to the first port and the port information corresponding to the second port, An association relationship between the first port and the second port is established.
本申请实施例中,媒体转发服务器在接收到第一终端和第二终端发送的信息后,可对双方信息中包含的自身终端标识以及目的终端标识进行匹配。In the embodiment of the present application, after receiving the information sent by the first terminal and the second terminal, the media forwarding server may match the own terminal identifier and the destination terminal identifier included in the information of both parties.
具体可以是,将第一终端发送的第一目的终端标识与第二终端发送的第二终端标识进行匹配,以确定需要与第一终端进行数据传输的终端是否为第二终端,并将第二终端发送的第二目的终端标识与第一终端发送的第一终端标识进行匹配,以确定需要与第二终端进行数据传输的终端是否为第一终端。Specifically, the first destination terminal identifier sent by the first terminal is matched with the second terminal identifier sent by the second terminal to determine whether the terminal that needs to perform data transmission with the first terminal is the second terminal, and the second The second destination terminal identifier sent by the terminal is matched with the first terminal identifier sent by the first terminal to determine whether the terminal that needs to perform data transmission with the second terminal is the first terminal.
示例性地,如图2所示,媒体转发服务器25在对第一终端21和第二终端22分别发送的RTP扩展报文进行解析并登记后,可将双方报文中携带的自身终端标识、目的终端标识进行交叉匹配,得到匹配结果。Exemplarily, as shown in FIG. 2 , after the media forwarding server 25 parses and registers the RTP extended messages sent by the first terminal 21 and the second terminal 22 respectively, it can transfer its own terminal identification, The target terminal identifier is cross-matched to obtain a matching result.
本申请实施例中,相匹配可以是终端标识相同时得到的匹配结果,不相匹配可以是终端标识不同时得到的匹配结果。In this embodiment of the present application, matching may be a matching result obtained when terminal identities are the same, and non-matching may be a matching result obtained when terminal identities are different.
另外,建立第一端口和第二端口之间的关联关系的方式可以是,将第一端口的端口信息与第二端口对应的端口信息进行关联保存,当查询到其中一个端口信息时,可得到关联保存的另一个端口信息。In addition, the way to establish the association relationship between the first port and the second port may be to store the port information of the first port in association with the port information corresponding to the second port, and when one of the port information is queried, it can be obtained Another port information saved in association.
示例性地,如图2所示,若第一终端21的目的终端标识与第二终端22的自身终端标识相同,且第二终端22的目的终端标识与第一终端21的自身终端标识相同,则说明第一终端21的数据将发往第二终端22,第二终端22的数据将发往第一终端21。如此,媒体转发服务器25可将第一端口和第二端口的端口信息进行对应,表示后续来自第一终端21的数据都将发往第二终端22的第二端口,来自第二终端22的数据都将发往第一终端21的第一端口。Exemplarily, as shown in FIG. 2, if the destination terminal identifier of the first terminal 21 is the same as the own terminal identifier of the second terminal 22, and the destination terminal identifier of the second terminal 22 is the same as the own terminal identifier of the first terminal 21, It means that the data of the first terminal 21 will be sent to the second terminal 22 , and the data of the second terminal 22 will be sent to the first terminal 21 . In this way, the media forwarding server 25 can correspond the port information of the first port and the second port, indicating that subsequent data from the first terminal 21 will be sent to the second port of the second terminal 22, and data from the second terminal 22 will be sent to the second port of the second terminal 22. All will be sent to the first port of the first terminal 21.
另外,在一些实施方式中,在第一端口包括第一音频端口和第一视频端口,第二端口包括第二音频端口和第二视频端口的情况下,上述S320具体可以包括:In addition, in some implementation manners, in the case where the first port includes a first audio port and a first video port, and the second port includes a second audio port and a second video port, the above S320 may specifically include:
基于第一音频端口的端口信息和第二音频端口的端口信息,建立第一音频端口和第二音频端口之间的关联关系;Establishing an association relationship between the first audio port and the second audio port based on the port information of the first audio port and the port information of the second audio port;
基于第一视频端口的端口信息和第二视频端口的端口信息,建立第一视频端口和第二视频端口之间的关联关系。Based on the port information of the first video port and the port information of the second video port, an association relationship between the first video port and the second video port is established.
示例性地,媒体转发服务器可将第一音频端口的端口信息与第二音频端口的端口信息进行对应和关联存储,以建立第一终端的第一音频端口与第二终端的第二音频端口之间的关联关系,还可将第一视频端口的端口信息与第二视频端口的端口信息进行对应和关联存储,以建立第一终端的第一视频端口与第二终端的第二视频端口之间的关联关系。Exemplarily, the media forwarding server may associate and store the port information of the first audio port and the port information of the second audio port, so as to establish a connection between the first audio port of the first terminal and the second audio port of the second terminal. In addition, the port information of the first video port and the port information of the second video port can be associated and stored to establish a relationship between the first video port of the first terminal and the second video port of the second terminal. relationship.
这样,通过分别建立两个音频端口和两个视频端口之间的关联关系,可以保证第一终端的音视频RTP/RTCP数据能被分别正确转发至第二终端,并保证第二终端的音视频RTP/RTCP数据能被分别正确转发至第一终端,提高数据传输的可靠性。In this way, by establishing an association between two audio ports and two video ports, it can be ensured that the audio and video RTP/RTCP data of the first terminal can be correctly forwarded to the second terminal respectively, and that the audio and video data of the second terminal can be correctly forwarded to the second terminal. The RTP/RTCP data can be correctly forwarded to the first terminal respectively, thereby improving the reliability of data transmission.
另外,第一终端的音视频端口信息与第二终端的音视频端口信息一一对应后,此端口关联关系可在媒体转发服务器中记录维护,作为后续数据交互时数据转发的依据。In addition, after the audio-video port information of the first terminal is in one-to-one correspondence with the audio-video port information of the second terminal, the port association relationship can be recorded and maintained in the media forwarding server as the basis for data forwarding during subsequent data interactions.
S330,根据关联关系,在第一终端和第二终端之间进行数据交互。S330. Perform data interaction between the first terminal and the second terminal according to the association relationship.
这里,第一终端和第二终端之间可互相发送数据。Here, the first terminal and the second terminal can send data to each other.
示例性地,当第一终端向第二终端发送数据时,媒体转发服务器可根据第一端口与第二端口之间的关联关系,将第一终端发送的数据转发至第二端口;当第二终端向第一终端发送数据时,媒体转发服务器可根据第一端口与第二端口之间的关联关系,将第二终端发送的数据转发至第一端口,从而实现第一终端和第二终端之间的数据交互。这样,媒体转发服务器只需对外提供一个端口,用于接收第一终端和第二终端发送的数据,即可在媒体转发服务器内部实现不同端口之间数据的转发。Exemplarily, when the first terminal sends data to the second terminal, the media forwarding server may forward the data sent by the first terminal to the second port according to the association relationship between the first port and the second port; When the terminal sends data to the first terminal, the media forwarding server can forward the data sent by the second terminal to the first port according to the association relationship between the first port and the second port, so as to realize the connection between the first terminal and the second terminal. data interaction between them. In this way, the media forwarding server only needs to provide one external port for receiving the data sent by the first terminal and the second terminal, and the data forwarding between different ports can be realized inside the media forwarding server.
由此,通过设置数据转发服务,接收第一终端发送的第一信息,以及第二终端发送的第二信息,在第一信息中的第一目的终端标识与第二信息中的第二终端标识相匹配,且第二信息中的第二目的终端标识与第一信息中的第一终端标识相匹配的情况下,在第一终端提供的第一端口和第二终端提供的第二端口之间建立关联关系,并利用该关联关系,进行数据转发,实现第一终端和第二终端之间的数据交互。这样,服务器无需再为每对终端都提供专用的数据传输端口,而只需提供公网的一个端口,通过该端口接收终端需要传输的数据,并基于终端端口之间的关联关系进行数据转发,即可实现任意两个终端之间的数据传输,实现了公网端口的复用,节省了公网的端口资源,提高了服务器所能支撑的终端最大连接数。Thus, by setting the data forwarding service, receiving the first information sent by the first terminal and the second information sent by the second terminal, the first destination terminal identifier in the first information and the second terminal identifier in the second information match, and the second destination terminal identifier in the second information matches the first terminal identifier in the first information, between the first port provided by the first terminal and the second port provided by the second terminal An association relationship is established, and data forwarding is performed using the association relationship, so as to realize data interaction between the first terminal and the second terminal. In this way, the server no longer needs to provide a dedicated data transmission port for each pair of terminals, but only needs to provide a port on the public network, through which the data that the terminal needs to transmit is received, and the data is forwarded based on the association relationship between the terminal ports. It can realize data transmission between any two terminals, realize the multiplexing of public network ports, save the port resources of the public network, and increase the maximum number of terminal connections that the server can support.
基于此,在一些实施方式中,上述S330具体可以包括:Based on this, in some implementation manners, the above S330 may specifically include:
接收第一终端从第一端口发送的第一数据;receiving first data sent by the first terminal from the first port;
根据关联关系,确定与第一端口关联的第二端口;determining a second port associated with the first port according to the association relationship;
将第一数据转发至第二端口,以将第一数据发送至第二终端;Forwarding the first data to the second port, so as to send the first data to the second terminal;
和/或,and / or,
接收第二终端从第二端口发送的第二数据;receiving second data sent by the second terminal from the second port;
根据关联关系,确定与第二端口关联的第一端口;determining the first port associated with the second port according to the association relationship;
将第二数据转发至第一端口,以将第二数据发送至第一终端。Forwarding the second data to the first port, so as to send the second data to the first terminal.
这里,媒体转发服务器中可设置一个目标端口,该目标端口可以是流媒体服务系统设置在公网的一个端口,用于接收和发送各个终端发送的数据。其中,该数据可以包括音频数据和视频数据中的至少一项。音频数据可以包括音频RTP数据和音频RTCP数据中的至少一项,视频数据可以包括视频RTP数据和视频RTCP数据中的至少一项。Here, a target port may be set in the media forwarding server, and the target port may be a port set in the public network by the streaming media service system, and is used for receiving and sending data sent by each terminal. Wherein, the data may include at least one of audio data and video data. The audio data may include at least one of audio RTP data and audio RTCP data, and the video data may include at least one of video RTP data and video RTCP data.
示例性地,如图2所示,第一终端21在发送RTP扩展报文,并收到媒体转发服务器25发送的ACK确认报文后,开始向媒体转发服务器25提供的设置在公网的一个媒体端口正常发送音视频RTP/RTCP数据,以将数据发送至媒体转发服务器25。此时媒体转发服务器25对第一终端21的音视频数据转发去向已经通过步骤S320明确,则按服务器中登记保存的关联端口信息进行数据转发,最终将第一终端21的音视频RTP/RTCP数据转发至第二终端22。第二终端22向第一终端21发送音视频RTP/RTCP数据时同理,在此不再赘述。至此,第一终端21与第二终端22开始双向音视频RTP/RTCP数据交互。Exemplarily, as shown in FIG. 2, after the first terminal 21 sends the RTP extended message and receives the ACK confirmation message sent by the media forwarding server 25, it starts to provide the media forwarding server 25 with a The media port normally sends audio and video RTP/RTCP data to send the data to the media forwarding server 25 . At this moment, the forwarding direction of the audio and video data of the first terminal 21 by the media forwarding server 25 has been made clear through step S320, and then data forwarding is carried out according to the associated port information registered and saved in the server, and finally the audio and video RTP/RTCP data of the first terminal 21 is forwarded. forwarded to the second terminal 22. The same is true when the second terminal 22 sends the audio/video RTP/RTCP data to the first terminal 21 , which will not be repeated here. So far, the first terminal 21 and the second terminal 22 start two-way audio and video RTP/RTCP data interaction.
这样,各个终端只需知道媒体转发服务器提供的一个目标端口,即可在任意两个终端之间实现音视频通话,实现了端口的复用。In this way, each terminal only needs to know a target port provided by the media forwarding server, and can implement audio and video calls between any two terminals, realizing port multiplexing.
基于此,在一些实施方式中,在第二端口包括第二音频端口和第二视频端口的情况下,若第一数据包括第一音频数据和第一视频数据,则上述将第一数据转发至第二端口的步骤,具体可以包括:Based on this, in some embodiments, if the second port includes the second audio port and the second video port, if the first data includes the first audio data and the first video data, then the above-mentioned first data is forwarded to The step of the second port may specifically include:
将第一音频数据转发至第二音频端口;Forwarding the first audio data to the second audio port;
将第一视频数据转发至第二视频端口。Forwarding the first video data to the second video port.
这里,可将第一音频数据和第一视频数据分别转发至不同类型的第二端口。具体可以是,将第一音频数据转发至第二音频端口,将第一视频数据转发至第二视频端口。Here, the first audio data and the first video data may be respectively forwarded to different types of second ports. Specifically, the first audio data may be forwarded to the second audio port, and the first video data may be forwarded to the second video port.
示例性地,媒体转发服务器可将第一终端发送的音频RTP/RTCP数据,转发至第二终端的音频端口,将第一终端发送的视频RTP/RTCP数据,转发至第二终端的视频端口。Exemplarily, the media forwarding server may forward the audio RTP/RTCP data sent by the first terminal to the audio port of the second terminal, and forward the video RTP/RTCP data sent by the first terminal to the video port of the second terminal.
这样,将第一终端发送的音频数据和视频数据分别转发到第二终端的不同端口,可以提高数据传输的可靠性。In this way, the audio data and video data sent by the first terminal are respectively forwarded to different ports of the second terminal, which can improve the reliability of data transmission.
同理,在一些实施方式中,在第一端口包括第一音频端口和第一视频端口的情况下,若第一数据包括第一音频数据和第一视频数据,则上述将第二数据转发至第一端口的步骤,具体可以包括:Similarly, in some implementations, when the first port includes the first audio port and the first video port, if the first data includes the first audio data and the first video data, then the above-mentioned second data is forwarded to The steps of the first port may specifically include:
将第二音频数据转发至第一音频端口;forwarding the second audio data to the first audio port;
将第二视频数据转发至第一视频端口。Forwarding the second video data to the first video port.
这里,可将第二音频数据和第二视频数据分别转发至不同类型的第一端口。具体可以是,将第二音频数据转发至第一音频端口,将第二视频数据转发至第一视频端口。Here, the second audio data and the second video data may be respectively forwarded to different types of first ports. Specifically, the second audio data may be forwarded to the first audio port, and the second video data may be forwarded to the first video port.
示例性地,媒体转发服务器可将第二终端发送的音频RTP/RTCP数据,转发至第一终端的音频端口,将第二终端发送的视频RTP/RTCP数据,转发至第一终端的视频端口。Exemplarily, the media forwarding server may forward the audio RTP/RTCP data sent by the second terminal to the audio port of the first terminal, and forward the video RTP/RTCP data sent by the second terminal to the video port of the first terminal.
这样,将第二终端发送的音频数据和视频数据分别转发到第一终端的不同端口,可以提高数据传输的可靠性。In this way, the audio data and video data sent by the second terminal are respectively forwarded to different ports of the first terminal, which can improve the reliability of data transmission.
图4是本申请一个实施例提供的数据交互方法的流程图。该数据交互方法可应用于终端,例如上述图2中的第一终端21或第二终端22。Fig. 4 is a flowchart of a data interaction method provided by an embodiment of the present application. This data interaction method can be applied to a terminal, such as the first terminal 21 or the second terminal 22 in FIG. 2 above.
如图4所示,该数据交互方法可以包括:As shown in Figure 4, the data interaction method may include:
S410,获取与第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息;S410. Acquire a first terminal identifier corresponding to the first terminal, a first destination terminal identifier, and port information corresponding to the first port;
S420,向服务器发送包括第一终端标识、第一目的终端标识和第一端口对应的端口信息的第一信息,以使服务器根据第一信息和第二终端发送的第二信息,建立第一端口和第二终端的第二端口之间的关联关系;S420. Send to the server first information including the first terminal identifier, the first destination terminal identifier, and port information corresponding to the first port, so that the server establishes the first port according to the first information and the second information sent by the second terminal an association relationship with the second port of the second terminal;
S430,基于关联关系,通过服务器与第二终端进行数据交互。S430. Based on the association relationship, perform data interaction with the second terminal through the server.
上述相关解释可参考前述各个实施例的相关部分,在此不再赘述。For the relevant explanations above, reference may be made to relevant parts of the foregoing embodiments, and details are not repeated here.
由此,通过向服务器发送包括第一终端标识、第一目标终端标识和第一端口对应的端口信息的第一信息,以使服务器根据第一终端发送的第一信息和第二终端发送的第二信息,建立第一终端的第一端口和第二终端的第二端口之间的关联关系,进而利用该关联关系,进行数据转发,实现第一终端和第二终端之间的数据交互。这样,服务器无需再为每对终端都提供专用的数据传输端口,而只需提供公网的一个端口,第一终端等各个终端即可通过该端口发送或接收需要传输的数据,并基于终端端口之间的关联关系实现任意两个终端之间的数据传输,从而实现了公网端口的复用,节省了公网的端口资源,提高了服务器所能支撑的终端最大连接数。Therefore, by sending the first information including the first terminal identifier, the first target terminal identifier, and the port information corresponding to the first port to the server, the server can make the first information sent by the first terminal and the first information sent by the second terminal The second information is to establish an association relationship between the first port of the first terminal and the second port of the second terminal, and then use the association relationship to perform data forwarding and realize data interaction between the first terminal and the second terminal. In this way, the server no longer needs to provide a dedicated data transmission port for each pair of terminals, but only needs to provide a port on the public network, and each terminal such as the first terminal can send or receive the data to be transmitted through this port, and based on the terminal port The association relationship between them realizes the data transmission between any two terminals, thereby realizing the multiplexing of public network ports, saving the port resources of the public network, and increasing the maximum number of terminal connections that the server can support.
在一些实施方式中,在上述S420之前,本申请实施例提供的数据交互方法还可以包括:In some implementations, before the above S420, the data interaction method provided in the embodiment of the present application may further include:
获取与第一终端对应的第一终端地址信息和第一配置参数;Acquire first terminal address information and first configuration parameters corresponding to the first terminal;
向服务器发送针对第二终端的呼叫信息,以通过服务器转发至第二终端,其中,呼叫信息中包括第一终端地址信息和第一配置参数,呼叫信息用于指示第二终端根据第一配置参数建立第一数据处理模块,并指示第二终端根据第一终端地址信息通过服务器向第一终端发送响应信息,第一数据处理模块用于接收并处理第一终端发送的数据;Sending call information for the second terminal to the server, so as to be forwarded to the second terminal through the server, wherein the call information includes the address information of the first terminal and the first configuration parameters, and the call information is used to instruct the second terminal to Establish a first data processing module, and instruct the second terminal to send response information to the first terminal through the server according to the address information of the first terminal, and the first data processing module is used to receive and process the data sent by the first terminal;
接收服务器发送的响应信息,其中,响应信息中包括与第二终端对应的第二终端地址信息和第二配置参数;receiving response information sent by the server, where the response information includes second terminal address information and second configuration parameters corresponding to the second terminal;
根据第二配置参数建立第二数据处理模块,其中,第二数据处理模块用于接收并处理第二终端发送的数据。A second data processing module is established according to the second configuration parameter, wherein the second data processing module is configured to receive and process data sent by the second terminal.
这里,第一终端地址信息可以包括第一终端对应的一个或多个候选地址信息,第一配置参数可以是与数据处理相关的参数,例如当数据为音视频数据时,第一配置参数例如可以是音视频流配置参数。另外,第二终端地址信息可以包括第二终端对应的一个或多个候选地址信息,第二配置参数可以是与数据处理相关的参数。Here, the first terminal address information may include one or more candidate address information corresponding to the first terminal, and the first configuration parameter may be a parameter related to data processing. For example, when the data is audio and video data, the first configuration parameter may be It is an audio and video stream configuration parameter. In addition, the second terminal address information may include one or more candidate address information corresponding to the second terminal, and the second configuration parameter may be a parameter related to data processing.
另外,呼叫信息例如可以是SIP呼叫信令,相应地,响应信息例如可以是SIP呼叫响应消息。In addition, the call information may be, for example, SIP call signaling, and correspondingly, the response information may be, for example, a SIP call response message.
示例性地,如图2所示,第一终端21整理收集自身的候选地址信息、音视频流配置参数组合成SDP信息,作为SIP呼叫信令的消息体,发送至信令服务器23,信令服务器23将收到的SIP呼叫信令转发至流媒体服务器24,流媒体服务器24对SIP呼叫信令进行解析处理,找到呼叫的第二终端22,然后将SIP呼叫信令通过信令服务器23转发到第二终端22。Exemplarily, as shown in FIG. 2, the first terminal 21 organizes and collects its own candidate address information, audio and video stream configuration parameters and combines them into SDP information, which is sent to the signaling server 23 as the message body of the SIP call signaling, and the signaling The server 23 forwards the received SIP call signaling to the streaming media server 24, and the streaming media server 24 analyzes the SIP calling signaling, finds the second terminal 22 of the call, and forwards the SIP calling signaling through the signaling server 23 to the second terminal 22 .
第二终端22对收到的SIP呼叫信令进行解析,找到消息发送源,也即第一终端21,然后同样整理自身的候选地址信息、音视频流配置参数并组合成SDP信息,作为SIP呼叫响应消息的消息体,发送至信令服务器23;信令服务器23将SIP呼叫响应消息转发至流媒体服务器24,流媒体服务器24在收到SIP呼叫响应消息后,对SIP呼叫响应消息进行解析处理,找到响应消息发送的目的终端,也即第一终端21,然后将SIP呼叫响应消息通过信令服务器23转发到第一终端21。The second terminal 22 analyzes the received SIP call signaling, finds the source of the message, that is, the first terminal 21, and then also organizes its own candidate address information, audio and video stream configuration parameters and combines them into SDP information as a SIP call The message body of the response message is sent to the signaling server 23; the signaling server 23 forwards the SIP call response message to the streaming server 24, and the streaming server 24 parses the SIP call response message after receiving the SIP call response message , find the destination terminal for sending the response message, that is, the first terminal 21, and then forward the SIP call response message to the first terminal 21 through the signaling server 23.
与此同时,第二终端22同时通过解析收到的SIP呼叫信令,得到第一终端21的音视频媒体参数,通过解析媒体参数,建立数据接收通道、音视频编解码器等相应工作,准备接收第一终端21发过来的数据。At the same time, the second terminal 22 obtains the audio and video media parameters of the first terminal 21 by analyzing the received SIP call signaling at the same time, and establishes corresponding tasks such as data receiving channels and audio and video codecs by analyzing the media parameters, and prepares The data sent by the first terminal 21 is received.
第一终端21收到第二终端22的SIP呼叫响应消息后,确认双方已经协商好数据的相关配置参数。接着第一终端21开始解析SIP呼叫响应消息,得到第二终端22的音视频媒体参数,通过解析媒体参数,建立相应的数据接收通道、音视频编解码器等工作,准备接收第二终端22发过来的数据。After receiving the SIP call response message from the second terminal 22, the first terminal 21 confirms that the two parties have negotiated related data configuration parameters. Then the first terminal 21 starts to analyze the SIP call response message, obtains the audio and video media parameters of the second terminal 22, and by analyzing the media parameters, establishes corresponding data receiving channels, audio and video codecs, etc., and is ready to receive the second terminal 22. coming data.
这样,通过在需要通话的两个终端之间互相传递终端地址信息和配置参数,可以在两个终端上分别建立数据处理模块,以便对后续接收到的数据进行处理。In this way, by transferring terminal address information and configuration parameters between two terminals that need to talk, data processing modules can be respectively established on the two terminals to process subsequent received data.
另外,在一些实施方式中,上述S430具体可以包括:In addition, in some implementation manners, the above S430 may specifically include:
在服务器成功建立关联关系的情况下,从第一端口向服务器发送第一数据,以使服务器根据关联关系,将第一数据转发至第二终端的第二端口。When the server successfully establishes the association relationship, the first data is sent from the first port to the server, so that the server forwards the first data to the second port of the second terminal according to the association relationship.
这里,在第一终端接收到服务器发送的ACK确认报文后,可确定服务器已成功建立第一端口与第二端口之间的关联关系,此时可开始与第二终端进行数据交互。Here, after the first terminal receives the ACK confirmation message sent by the server, it can be determined that the server has successfully established the association relationship between the first port and the second port, and at this time, data interaction with the second terminal can begin.
这样,通过在确定服务器成功建立关联关系后,由第一终端的第一端口向服务器发送第一数据,进而使得服务器可以根据第一端口与第二端口之间的关联关系,对第一数据进行转发,从而无需服务器为每一个通话都设置一个专门的端口,即可实现第一终端向第二终端的数据发送,实现了公网端口的复用。In this way, after it is determined that the server successfully establishes the association relationship, the first port of the first terminal sends the first data to the server, so that the server can process the first data according to the association relationship between the first port and the second port. Forwarding, so that there is no need for the server to set a special port for each call, the data transmission from the first terminal to the second terminal can be realized, and the multiplexing of public network ports can be realized.
另外,当第二终端向第一终端发送数据时,第二终端可从第二端口向服务器发送第二数据,以使服务器根据关联关系,将第二数据转发至第一终端的第一端口。In addition, when the second terminal sends data to the first terminal, the second terminal can send the second data to the server from the second port, so that the server forwards the second data to the first port of the first terminal according to the association relationship.
需要说明的是,上述本公开实施例描述的应用场景是为了更加清楚的说明本公开实施例的技术方案,并不构成对于本公开实施例提供的技术方案的限定,本领域普通技术人员可知,随着新应用场景的出现,本公开实施例提供的技术方案对于类似的技术问题,同样适用。It should be noted that the application scenarios described in the above-mentioned embodiments of the present disclosure are for more clearly illustrating the technical solutions of the embodiments of the present disclosure, and do not constitute limitations on the technical solutions provided by the embodiments of the present disclosure. Those skilled in the art know that, With the emergence of new application scenarios, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems.
基于相同的发明构思,本申请还提供了数据交互装置。下面结合图5和图6对本申请实施例提供的数据交互装置进行详细说明。Based on the same inventive concept, the present application also provides a data interaction device. The data interaction device provided by the embodiment of the present application will be described in detail below with reference to FIG. 5 and FIG. 6 .
图5是本申请一个实施例提供的数据交互装置的结构框图。该数据交互装置可配置于服务器,例如上述图2中的媒体转发服务器25。Fig. 5 is a structural block diagram of a data interaction device provided by an embodiment of the present application. The data interaction device may be configured in a server, such as the media forwarding server 25 in FIG. 2 above.
如图5所示,数据交互装置500可以包括:As shown in Figure 5, the data interaction device 500 may include:
信息接收模块501,用于接收第一终端发送的第一信息,以及第二终端发送的第二信息,其中,所述第一信息中包括所述第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息,所述第二信息中包括所述第二终端对应的第二终端标识、第二目的终端标识和第二端口对应的端口信息;An information receiving module 501, configured to receive first information sent by the first terminal and second information sent by the second terminal, wherein the first information includes the first terminal identifier corresponding to the first terminal, the first The destination terminal identifier and port information corresponding to the first port, where the second information includes a second terminal identifier corresponding to the second terminal, a second destination terminal identifier, and port information corresponding to the second port;
关系建立模块503,用于在所述第一目的终端标识与所述第二终端标识相匹配,且所述第二目的终端标识与所述第一终端标识相匹配的情况下,基于所述第一端口对应的端口信息和所述第二端口对应的端口信息,建立所述第一端口和所述第二端口之间的关联关系;The relationship establishment module 503 is configured to: in the case that the first destination terminal identifier matches the second terminal identifier, and the second destination terminal identifier matches the first terminal identifier, based on the second Port information corresponding to a port and port information corresponding to the second port, establishing an association relationship between the first port and the second port;
数据交互模块503,用于根据所述关联关系,在所述第一终端和所述第二终端之间进行数据交互。A data interaction module 503, configured to perform data interaction between the first terminal and the second terminal according to the association relationship.
下面对上述数据交互装置500进行详细说明,具体如下所示:The above-mentioned data interaction device 500 will be described in detail below, specifically as follows:
在其中一个实施例中,上述数据交互模块503具体可以包括:In one of the embodiments, the above-mentioned data interaction module 503 may specifically include:
第一接收子模块,用于接收所述第一终端从所述第一端口发送的第一数据;a first receiving submodule, configured to receive first data sent by the first terminal from the first port;
第一确定子模块,用于根据所述关联关系,确定与所述第一端口关联的所述第二端口;A first determining submodule, configured to determine the second port associated with the first port according to the association relationship;
第一转发子模块,用于将所述第一数据转发至所述第二端口,以将所述第一数据发送至所述第二终端;a first forwarding submodule, configured to forward the first data to the second port, so as to send the first data to the second terminal;
和/或,and / or,
第二接收子模块,用于接收所述第二终端从所述第二端口发送的第二数据;a second receiving submodule, configured to receive second data sent by the second terminal from the second port;
第二确定子模块,用于根据所述关联关系,确定与所述第二端口关联的所述第一端口;A second determining submodule, configured to determine the first port associated with the second port according to the association relationship;
第二转发子模块,用于将所述第二数据转发至所述第一端口,以将所述第二数据发送至所述第一终端。The second forwarding submodule is configured to forward the second data to the first port, so as to send the second data to the first terminal.
在其中一个实施例中,上述第一端口可以包括第一音频端口和第一视频端口,上述第二端口可以包括第二音频端口和第二视频端口。In one of the embodiments, the first port may include a first audio port and a first video port, and the second port may include a second audio port and a second video port.
在其中一个实施例中,上述关系建立模块503具体可以包括:In one of the embodiments, the relationship establishing module 503 may specifically include:
第一建立子模块,用于基于所述第一音频端口的端口信息和所述第二音频端口的端口信息,建立所述第一音频端口和所述第二音频端口之间的关联关系;A first establishing submodule, configured to establish an association relationship between the first audio port and the second audio port based on the port information of the first audio port and the port information of the second audio port;
第二建立子模块,用于基于所述第一视频端口的端口信息和所述第二视频端口的端口信息,建立所述第一视频端口和所述第二视频端口之间的关联关系。The second establishing submodule is configured to establish an association relationship between the first video port and the second video port based on the port information of the first video port and the port information of the second video port.
在其中一个实施例中,在所述第一数据包括第一音频数据和第一视频数据的情况下,上述第一转发子模块具体可以包括:In one of the embodiments, when the first data includes first audio data and first video data, the above-mentioned first forwarding submodule may specifically include:
第一转发单元,用于将所述第一音频数据转发至所述第二音频端口;a first forwarding unit, configured to forward the first audio data to the second audio port;
第二转发单元,用于将所述第一视频数据转发至所述第二视频端口;a second forwarding unit, configured to forward the first video data to the second video port;
在所述第二数据包括第二音频数据和第二视频数据的情况下,所述第二转发子模块包括:In the case where the second data includes second audio data and second video data, the second forwarding submodule includes:
第三转发单元,用于将所述第二音频数据转发至所述第一音频端口;a third forwarding unit, configured to forward the second audio data to the first audio port;
第四转发单元,用于将所述第二视频数据转发至所述第一视频端口。A fourth forwarding unit, configured to forward the second video data to the first video port.
由此,通过设置数据转发服务,接收第一终端发送的第一信息,以及第二终端发送的第二信息,在第一信息中的第一目的终端标识与第二信息中的第二终端标识相匹配,且第二信息中的第二目的终端标识与第一信息中的第一终端标识相匹配的情况下,在第一终端提供的第一端口和第二终端提供的第二端口之间建立关联关系,并利用该关联关系,进行数据转发,实现第一终端和第二终端之间的数据交互。这样,服务器无需再为每对终端都提供专用的数据传输端口,而只需提供公网的一个端口,通过该端口接收终端需要传输的数据,并基于终端端口之间的关联关系进行数据转发,即可实现任意两个终端之间的数据传输,实现了公网端口的复用,节省了公网的端口资源,提高了服务器所能支撑的终端最大连接数。Thus, by setting the data forwarding service, receiving the first information sent by the first terminal and the second information sent by the second terminal, the first destination terminal identifier in the first information and the second terminal identifier in the second information match, and the second destination terminal identifier in the second information matches the first terminal identifier in the first information, between the first port provided by the first terminal and the second port provided by the second terminal An association relationship is established, and data forwarding is performed using the association relationship, so as to realize data interaction between the first terminal and the second terminal. In this way, the server no longer needs to provide a dedicated data transmission port for each pair of terminals, but only needs to provide a port on the public network, through which the data that the terminal needs to transmit is received, and the data is forwarded based on the association relationship between the terminal ports. It can realize data transmission between any two terminals, realize the multiplexing of public network ports, save the port resources of the public network, and increase the maximum number of terminal connections that the server can support.
图6是本申请一个实施例提供的数据交互装置的结构框图。该数据交互装置可配置于终端,例如上述图2中的第一终端21或第二终端22。Fig. 6 is a structural block diagram of a data interaction device provided by an embodiment of the present application. The data exchange device may be configured in a terminal, such as the first terminal 21 or the second terminal 22 in FIG. 2 above.
如图6所示,数据交互装置600可以包括:As shown in Figure 6, the data interaction device 600 may include:
信息获取模块601,用于获取与第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息;An information acquiring module 601, configured to acquire a first terminal identifier corresponding to the first terminal, a first destination terminal identifier, and port information corresponding to the first port;
信息发送模块602,用于向服务器发送包括所述第一终端标识、所述第一目的终端标识和所述第一端口对应的端口信息的第一信息,以使所述服务器根据所述第一信息和第二终端发送的第二信息,建立所述第一端口和所述第二终端的第二端口之间的关联关系;An information sending module 602, configured to send to a server first information including the first terminal identifier, the first destination terminal identifier, and port information corresponding to the first port, so that the server information and second information sent by the second terminal, establishing an association relationship between the first port and the second port of the second terminal;
信息交互模块603,用于基于所述关联关系,通过所述服务器与所述第二终端进行数据交互。An information interaction module 603, configured to perform data interaction with the second terminal through the server based on the association relationship.
下面对上述数据交互装置600进行详细说明,具体如下所示:The above-mentioned data interaction device 600 will be described in detail below, specifically as follows:
在其中一个实施例中,上述数据交互装置600还包括:In one of the embodiments, the above-mentioned data interaction device 600 further includes:
参数获取模块,用于向服务器发送包括所述第一终端标识、所述第一目的终端标识和所述第一端口对应的端口信息的第一信息之前,获取与所述第一终端对应的第一终端地址信息和第一配置参数;A parameter acquiring module, configured to acquire the first terminal corresponding to the first terminal before sending the first information including the first terminal identifier, the first destination terminal identifier, and port information corresponding to the first port to the server. a terminal address information and a first configuration parameter;
终端呼叫模块,用于向服务器发送针对所述第二终端的呼叫信息,以通过所述服务器转发至所述第二终端,其中,所述呼叫信息中包括所述第一终端地址信息和所述第一配置参数,所述呼叫信息用于指示所述第二终端根据所述第一配置参数建立第一数据处理模块,并指示所述第二终端根据所述第一终端地址信息通过所述服务器向所述第一终端发送响应信息,所述第一数据处理模块用于接收并处理所述第一终端发送的数据;a terminal calling module, configured to send call information for the second terminal to a server, so as to be forwarded to the second terminal by the server, wherein the call information includes the address information of the first terminal and the The first configuration parameter, the call information is used to instruct the second terminal to establish a first data processing module according to the first configuration parameter, and instruct the second terminal to pass through the server according to the address information of the first terminal Sending response information to the first terminal, the first data processing module is configured to receive and process data sent by the first terminal;
响应接收模块,用于接收所述服务器发送的所述响应信息,其中,所述响应信息中包括与所述第二终端对应的第二终端地址信息和第二配置参数;a response receiving module, configured to receive the response information sent by the server, wherein the response information includes second terminal address information and second configuration parameters corresponding to the second terminal;
配置建立模块,用于根据所述第二配置参数建立第二数据处理模块,其中,所述第二数据处理模块用于接收并处理所述第二终端发送的数据。A configuration establishing module, configured to establish a second data processing module according to the second configuration parameters, wherein the second data processing module is configured to receive and process data sent by the second terminal.
在其中一个实施例中,所述信息交互模块603包括:In one of the embodiments, the information interaction module 603 includes:
数据发送子模块,用于在所述服务器成功建立所述关联关系的情况下,从所述第一端口向所述服务器发送第一数据,以使所述服务器根据所述关联关系,将所述第一数据转发至所述第二终端的所述第二端口。A data sending submodule, configured to send first data from the first port to the server when the server successfully establishes the association relationship, so that the server sends the The first data is forwarded to the second port of the second terminal.
由此,通过向服务器发送包括第一终端标识、第一目标终端标识和第一端口对应的端口信息的第一信息,以使服务器根据第一终端发送的第一信息和第二终端发送的第二信息,建立第一终端的第一端口和第二终端的第二端口之间的关联关系,进而利用该关联关系,进行数据转发,实现第一终端和第二终端之间的数据交互。这样,服务器无需再为每对终端都提供专用的数据传输端口,而只需提供公网的一个端口,第一终端等各个终端即可通过该端口发送或接收需要传输的数据,并基于终端端口之间的关联关系实现任意两个终端之间的数据传输,从而实现了公网端口的复用,节省了公网的端口资源,提高了服务器所能支撑的终端最大连接数。Therefore, by sending the first information including the first terminal identifier, the first target terminal identifier, and the port information corresponding to the first port to the server, the server can make the first information sent by the first terminal and the first information sent by the second terminal The second information is to establish an association relationship between the first port of the first terminal and the second port of the second terminal, and then use the association relationship to perform data forwarding and realize data interaction between the first terminal and the second terminal. In this way, the server no longer needs to provide a dedicated data transmission port for each pair of terminals, but only needs to provide a port on the public network, and each terminal such as the first terminal can send or receive the data to be transmitted through this port, and based on the terminal port The association relationship between them realizes the data transmission between any two terminals, thereby realizing the multiplexing of public network ports, saving the port resources of the public network, and increasing the maximum number of terminal connections that the server can support.
本申请实施例中的数据交互装置可以是电子设备,也可以是电子设备中的部件,例如集成电路或芯片。该电子设备可以是终端,也可以为除终端之外的其他设备。示例性的,电子设备可以为服务器、网络附属存储器(Network Attached Storage,NAS)、个人计算机(personal computer,PC)、云服务器或服务器集群等,本申请实施例不作具体限定。The data interaction device in the embodiment of the present application may be an electronic device, or may be a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal, or other devices other than the terminal. Exemplarily, the electronic device may be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a cloud server, or a server cluster, etc., which are not specifically limited in this embodiment of the present application.
本申请实施例中的数据交互装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为iOS操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。The data interaction device in the embodiment of the present application may be a device with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in this embodiment of the present application.
本申请实施例提供的数据交互装置能够实现图3和图4所示的方法实施例实现的各个过程,为避免重复,这里不再赘述。The data interaction device provided by the embodiment of the present application can realize various processes realized by the method embodiments shown in FIG. 3 and FIG. 4 , and details are not repeated here to avoid repetition.
可选的,如图7所示,本申请实施例还提供一种电子设备700,包括处理器701和存储器702,存储在存储器702上存储有可在处理器701上运行的程序或指令,该程序或指令被处理器701执行时实现上述数据交互方法实施例的各个步骤,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, as shown in FIG. 7 , the embodiment of the present application also provides an electronic device 700, including a processor 701 and a memory 702, and the memory 702 stores programs or instructions that can run on the processor 701. When the programs or instructions are executed by the processor 701, the steps of the above-mentioned data interaction method embodiments can be realized, and the same technical effect can be achieved. In order to avoid repetition, details are not repeated here.
需要说明的是,本申请实施例中的电子设备包括上述的移动电子设备和非移动电子设备。It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
图8为实现本申请实施例的一种电子设备的硬件结构示意图。FIG. 8 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
该电子设备800包括但不限于:射频单元801、网络模块802、音频输出单元803、输入单元804、传感器805、显示单元806、用户输入单元807、接口单元808、存储器809、以及处理器610等部件。The electronic device 800 includes, but is not limited to: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, and a processor 610, etc. part.
本领域技术人员可以理解,电子设备800还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器610逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图8中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。Those skilled in the art can understand that the electronic device 800 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 610 through the power management system, so that the management of charging, discharging, and function can be realized through the power management system. Consumption management and other functions. The structure of the electronic device shown in FIG. 8 does not constitute a limitation to the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine some components, or arrange different components, and details will not be repeated here. .
在一些示例中,处理器810用于接收第一终端发送的第一信息,以及第二终端发送的第二信息,其中,所述第一信息中包括所述第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息,所述第二信息中包括所述第二终端对应的第二终端标识、第二目的终端标识和第二端口对应的端口信息;在所述第一目的终端标识与所述第二终端标识相匹配,且所述第二目的终端标识与所述第一终端标识相匹配的情况下,基于所述第一端口对应的端口信息和所述第二端口对应的端口信息,建立所述第一端口和所述第二端口之间的关联关系;根据所述关联关系,在所述第一终端和所述第二终端之间进行数据交互。In some examples, the processor 810 is configured to receive the first information sent by the first terminal and the second information sent by the second terminal, where the first information includes the first terminal identifier corresponding to the first terminal , the port information corresponding to the first destination terminal identifier and the first port, the second information includes the second terminal identifier corresponding to the second terminal, the second destination terminal identifier and port information corresponding to the second port; If the first destination terminal identifier matches the second terminal identifier, and the second destination terminal identifier matches the first terminal identifier, based on the port information corresponding to the first port and the The port information corresponding to the second port establishes an association relationship between the first port and the second port; and performs data interaction between the first terminal and the second terminal according to the association relationship.
可选的,处理器810,还用于接收所述第一终端从所述第一端口发送的第一数据;根据所述关联关系,确定与所述第一端口关联的所述第二端口;将所述第一数据转发至所述第二端口,以将所述第一数据发送至所述第二终端;和/或,接收所述第二终端从所述第二端口发送的第二数据;根据所述关联关系,确定与所述第二端口关联的所述第一端口;将所述第二数据转发至所述第一端口,以将所述第二数据发送至所述第一终端。Optionally, the processor 810 is further configured to receive the first data sent by the first terminal from the first port; determine the second port associated with the first port according to the association relationship; Forwarding the first data to the second port to send the first data to the second terminal; and/or receiving second data sent by the second terminal from the second port ; According to the association relationship, determine the first port associated with the second port; forward the second data to the first port, so as to send the second data to the first terminal .
可选的,处理器810,还用于基于所述第一音频端口的端口信息和所述第二音频端口的端口信息,建立所述第一音频端口和所述第二音频端口之间的关联关系;基于所述第一视频端口的端口信息和所述第二视频端口的端口信息,建立所述第一视频端口和所述第二视频端口之间的关联关系。Optionally, the processor 810 is further configured to establish an association between the first audio port and the second audio port based on the port information of the first audio port and the port information of the second audio port Relationship: establishing an association relationship between the first video port and the second video port based on the port information of the first video port and the port information of the second video port.
可选的,处理器810还用于将所述第一音频数据转发至所述第二音频端口;将所述第一视频数据转发至所述第二视频端口;将所述第二音频数据转发至所述第一音频端口;将所述第二视频数据转发至所述第一视频端口。Optionally, the processor 810 is further configured to forward the first audio data to the second audio port; forward the first video data to the second video port; forward the second audio data to the first audio port; forwarding the second video data to the first video port.
由此,通过设置数据转发服务,接收第一终端发送的第一信息,以及第二终端发送的第二信息,在第一信息中的第一目的终端标识与第二信息中的第二终端标识相匹配,且第二信息中的第二目的终端标识与第一信息中的第一终端标识相匹配的情况下,在第一终端提供的第一端口和第二终端提供的第二端口之间建立关联关系,并利用该关联关系,进行数据转发,实现第一终端和第二终端之间的数据交互。这样,服务器无需再为每对终端都提供专用的数据传输端口,而只需提供公网的一个端口,通过该端口接收终端需要传输的数据,并基于终端端口之间的关联关系进行数据转发,即可实现任意两个终端之间的数据传输,实现了公网端口的复用,节省了公网的端口资源,提高了服务器所能支撑的终端最大连接数。Thus, by setting the data forwarding service, receiving the first information sent by the first terminal and the second information sent by the second terminal, the first destination terminal identifier in the first information and the second terminal identifier in the second information match, and the second destination terminal identifier in the second information matches the first terminal identifier in the first information, between the first port provided by the first terminal and the second port provided by the second terminal An association relationship is established, and data forwarding is performed using the association relationship, so as to realize data interaction between the first terminal and the second terminal. In this way, the server no longer needs to provide a dedicated data transmission port for each pair of terminals, but only needs to provide a port on the public network, through which the data that the terminal needs to transmit is received, and the data is forwarded based on the association relationship between the terminal ports. It can realize data transmission between any two terminals, realize the multiplexing of public network ports, save the port resources of the public network, and increase the maximum number of terminal connections that the server can support.
在另一些示例中,处理器810用于获取与第一终端对应的第一终端标识、第一目的终端标识和第一端口对应的端口信息;向服务器发送包括所述第一终端标识、所述第一目的终端标识和所述第一端口对应的端口信息的第一信息,以使所述服务器根据所述第一信息和第二终端发送的第二信息,建立所述第一端口和所述第二终端的第二端口之间的关联关系;基于所述关联关系,通过所述服务器与所述第二终端进行数据交互。In some other examples, the processor 810 is configured to obtain port information corresponding to the first terminal identifier corresponding to the first terminal, the first destination terminal identifier, and the first port; The first information of the port information corresponding to the first destination terminal identifier and the first port, so that the server establishes the first port and the first port according to the first information and the second information sent by the second terminal. An association relationship between the second ports of the second terminal; based on the association relationship, data interaction is performed with the second terminal through the server.
可选的,处理器810还用于获取与所述第一终端对应的第一终端地址信息和第一配置参数;向服务器发送针对所述第二终端的呼叫信息,以通过所述服务器转发至所述第二终端,其中,所述呼叫信息中包括所述第一终端地址信息和所述第一配置参数,所述呼叫信息用于指示所述第二终端根据所述第一配置参数建立第一数据处理模块,并指示所述第二终端根据所述第一终端地址信息通过所述服务器向所述第一终端发送响应信息,所述第一数据处理模块用于接收并处理所述第一终端发送的数据;接收所述服务器发送的所述响应信息,其中,所述响应信息中包括与所述第二终端对应的第二终端地址信息和第二配置参数;根据所述第二配置参数建立第二数据处理模块,其中,所述第二数据处理模块用于接收并处理所述第二终端发送的数据。Optionally, the processor 810 is further configured to obtain the first terminal address information and first configuration parameters corresponding to the first terminal; send the call information for the second terminal to the server, so as to be forwarded to the server through the server. The second terminal, wherein the call information includes the address information of the first terminal and the first configuration parameter, and the call information is used to instruct the second terminal to establish a second terminal according to the first configuration parameter. a data processing module, and instruct the second terminal to send response information to the first terminal through the server according to the address information of the first terminal, and the first data processing module is used to receive and process the first The data sent by the terminal; receiving the response information sent by the server, wherein the response information includes the second terminal address information and the second configuration parameter corresponding to the second terminal; according to the second configuration parameter A second data processing module is established, wherein the second data processing module is configured to receive and process data sent by the second terminal.
可选的,处理器810还用于在所述服务器成功建立所述关联关系的情况下,从所述第一端口向所述服务器发送第一数据,以使所述服务器根据所述关联关系,将所述第一数据转发至所述第二终端的所述第二端口。Optionally, the processor 810 is further configured to, if the server successfully establishes the association relationship, send the first data from the first port to the server, so that the server, according to the association relationship, forwarding the first data to the second port of the second terminal.
由此,通过向服务器发送包括第一终端标识、第一目标终端标识和第一端口对应的端口信息的第一信息,以使服务器根据第一终端发送的第一信息和第二终端发送的第二信息,建立第一终端的第一端口和第二终端的第二端口之间的关联关系,进而利用该关联关系,进行数据转发,实现第一终端和第二终端之间的数据交互。这样,服务器无需再为每对终端都提供专用的数据传输端口,而只需提供公网的一个端口,第一终端等各个终端即可通过该端口发送或接收需要传输的数据,并基于终端端口之间的关联关系实现任意两个终端之间的数据传输,从而实现了公网端口的复用,节省了公网的端口资源,提高了服务器所能支撑的终端最大连接数。Therefore, by sending the first information including the first terminal identifier, the first target terminal identifier, and the port information corresponding to the first port to the server, the server can make the first information sent by the first terminal and the first information sent by the second terminal The second information is to establish an association relationship between the first port of the first terminal and the second port of the second terminal, and then use the association relationship to perform data forwarding and realize data interaction between the first terminal and the second terminal. In this way, the server no longer needs to provide a dedicated data transmission port for each pair of terminals, but only needs to provide a port on the public network, and each terminal such as the first terminal can send or receive the data to be transmitted through this port, and based on the terminal port The association relationship between them realizes the data transmission between any two terminals, thereby realizing the multiplexing of public network ports, saving the port resources of the public network, and increasing the maximum number of terminal connections that the server can support.
应理解的是,本申请实施例中,输入单元604可以包括图形处理器(GraphicsProcessing Unit,GPU)6041和麦克风6042,图形处理器6041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元606可包括显示面板6061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板6061。用户输入单元607包括触控面板6071以及其他输入设备6072中的至少一种。触控面板6071,也称为触摸屏。触控面板6071可包括触摸检测装置和触摸控制器两个部分。其他输入设备6072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。It should be understood that, in the embodiment of the present application, the input unit 604 may include a graphics processing unit (Graphics Processing Unit, GPU) 6041 and a microphone 6042, and the graphics processing unit 6041 is compatible with an image capture device (such as Camera) to process the image data of still pictures or videos. The display unit 606 may include a display panel 6061, and the display panel 6061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 607 includes at least one of a touch panel 6071 and other input devices 6072 . The touch panel 6071 is also called a touch screen. The touch panel 6071 may include two parts, a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, and joysticks, which will not be repeated here.
存储器609可用于存储软件程序以及各种数据。存储器609可主要包括存储程序或指令的第一存储区和存储数据的第二存储区,其中,第一存储区可存储操作系统、至少一个功能所需的应用程序或指令(比如声音播放功能、图像播放功能等)等。此外,存储器609可以包括易失性存储器或非易失性存储器,或者,存储器609可以包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synch link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请实施例中的存储器609包括但不限于这些和任意其它适合类型的存储器。The memory 609 can be used to store software programs as well as various data. The memory 609 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required by at least one function (such as a sound playing function, image playback function, etc.), etc. Furthermore, memory 609 may include volatile memory or nonvolatile memory, or, memory 609 may include both volatile and nonvolatile memory. Wherein, the non-volatile memory may be a read-only memory (Read-Only Memory, ROM), a programmable read-only memory (Programmable ROM, PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electronically programmable Erase Programmable Read-Only Memory (Electrically EPROM, EEPROM) or Flash. Volatile memory can be random access memory (Random Access Memory, RAM), static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDRSDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (Synch link DRAM , SLDRAM) and Direct Memory Bus Random Access Memory (Direct Rambus RAM, DRRAM). The memory 609 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
处理器610可可包括一个或多个处理单元;可选的,处理器610集成应用处理器和调制解调处理器,其中,应用处理器主要处理涉及操作系统、用户界面和应用程序等的操作,调制解调处理器主要处理无线通信信号,如基带处理器。可以理解的是,上述调制解调处理器也可以不集成到处理器610中。The processor 610 may include one or more processing units; optionally, the processor 610 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., Modem processors mainly process wireless communication signals, such as baseband processors. It can be understood that the foregoing modem processor may not be integrated into the processor 610 .
本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述数据交互方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application also provides a readable storage medium. The readable storage medium stores programs or instructions. When the program or instructions are executed by the processor, the various processes of the above-mentioned data interaction method embodiments can be achieved, and the same To avoid repetition, the technical effects will not be repeated here.
其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器ROM、随机存取存储器RAM、磁碟或者光盘等。Wherein, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk, and the like.
本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述数据交互方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the above data interaction method embodiment Each process can achieve the same technical effect, so in order to avoid repetition, it will not be repeated here.
应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。It should be understood that the chips mentioned in the embodiments of the present application may also be called system-on-chip, system-on-chip, system-on-a-chip, or system-on-a-chip.
本申请实施例提供一种计算机程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如上述数据交互方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application provides a computer program product, the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the various processes in the above data interaction method embodiment, and can achieve the same technical effect , to avoid repetition, it will not be repeated here.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. Functions are performed, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以计算机软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the technical solution of the present application can be embodied in the form of computer software products, which are stored in a storage medium (such as ROM/RAM, magnetic disk, etc.) , optical disc), including several instructions to enable a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementations. The above-mentioned specific implementations are only illustrative and not restrictive. Those of ordinary skill in the art will Under the inspiration of this application, without departing from the purpose of this application and the scope of protection of the claims, many forms can also be made, all of which belong to the protection of this application.
Claims (11)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310453075.4A CN116455877A (en) | 2023-04-24 | 2023-04-24 | Data interaction method, device and equipment |
| PCT/CN2024/088724 WO2024222574A1 (en) | 2023-04-24 | 2024-04-19 | Data exchange method and apparatus, and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310453075.4A CN116455877A (en) | 2023-04-24 | 2023-04-24 | Data interaction method, device and equipment |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116455877A true CN116455877A (en) | 2023-07-18 |
Family
ID=87125443
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310453075.4A Pending CN116455877A (en) | 2023-04-24 | 2023-04-24 | Data interaction method, device and equipment |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN116455877A (en) |
| WO (1) | WO2024222574A1 (en) |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP4855162B2 (en) * | 2006-07-14 | 2012-01-18 | 株式会社日立製作所 | Packet transfer apparatus and communication system |
| PL2478678T3 (en) * | 2009-09-17 | 2016-05-31 | Digifonica Int Ltd | Uninterrupted transmission of internet protocol transmissions during endpoint changes |
| CN111510414B (en) * | 2019-01-30 | 2022-01-11 | 华为技术有限公司 | Content transmitting method, content receiving method, content transmitting device, content receiving device, server, terminal device, and storage medium |
| CN112398845B (en) * | 2020-11-11 | 2023-03-28 | Oppo广东移动通信有限公司 | Data transmission method, data transmission device, data transmission system and electronic equipment |
-
2023
- 2023-04-24 CN CN202310453075.4A patent/CN116455877A/en active Pending
-
2024
- 2024-04-19 WO PCT/CN2024/088724 patent/WO2024222574A1/en active Pending
Also Published As
| Publication number | Publication date |
|---|---|
| WO2024222574A1 (en) | 2024-10-31 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3078182B1 (en) | Wireless media sharing from multiple sources to a single sink | |
| US7978216B2 (en) | Versatile conference adapter and method employing same | |
| US10798138B2 (en) | Instant calling method, apparatus and system | |
| CN105704426B (en) | Method, device and system for conducting video conferencing | |
| CN101641936B (en) | Media stream setup in a group communication system | |
| CN104125540A (en) | Multipoint communication device and method of performing switching from multipoint communication to point-to-point communication | |
| WO2018129876A1 (en) | Method for transmitting multimedia data, server and terminal | |
| CN113365234B (en) | Calling method, device and electronic equipment | |
| CN101222502B (en) | Method and device for media ability re-negotiation | |
| EP4391611A1 (en) | Information transmission method and apparatus | |
| CN103338346A (en) | Method and system for realizing multimedia digital conference | |
| CN108306986A (en) | Polymorphic type media data network address commutation traversing method, terminal and system | |
| CN103929623B (en) | Video data handling procedure in a kind of video monitoring system | |
| CN108574689B (en) | Method and device for video call | |
| CN100466728C (en) | Method, system and terminal equipment for realizing remote monitoring service between video terminals | |
| WO2021254442A1 (en) | Session initiation method, apparatus and system, electronic device, and computer readable storage medium | |
| US20150365133A1 (en) | Touch and Talk Auto-Configuring of Video Conferences Using Near Field Communication (NFC) | |
| CN116455877A (en) | Data interaction method, device and equipment | |
| WO2024083008A1 (en) | Data transmission method, apparatus and system, electronic device, and medium | |
| WO2023030384A1 (en) | Ims network registration method and apparatus, and electronic device | |
| CN113038518B (en) | Network registration method and device and user equipment | |
| CN116319698A (en) | Terminal connection method, electronic device and storage medium | |
| CN110809242B (en) | Media interaction method under DECT network cluster | |
| CN110876115B (en) | Projection method, terminal, projection equipment and storage medium | |
| CN106210364A (en) | A kind of call recording method and device, system |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |