network: use originating RTP packet address for loopback
When a connection is created in loopback mode all incoming packets should be reflected back to their origin. If the user did not supply a destination address with the CRCX command all incoming packets will be tossed because no destination address is officially known yet. If there is no destination address set and the connection is in loopback mode. Then use the originating address of the incoming packet as destination address. Change-Id: I3d1abe56d016e28c97f60635eb574679d36e2c52
This commit is contained in:
parent
7bc5552512
commit
5dbfc78aff
|
@ -1077,7 +1077,16 @@ static int rtp_data_net(struct osmo_fd *fd, unsigned int what)
|
|||
|
||||
/* Check if the connection is in loopback mode, if yes, just send the
|
||||
* incoming data back to the origin */
|
||||
|
||||
if (conn_src->conn->mode == MGCP_CONN_LOOPBACK) {
|
||||
/* When we are in loopback mode, we loop back all incoming
|
||||
* packets back to their origin. We will use the originating
|
||||
* address data from the UDP packet header to patch the
|
||||
* outgoing address in connection on the fly */
|
||||
if (conn_src->end.rtp_port == 0) {
|
||||
conn_src->end.addr = addr.sin_addr;
|
||||
conn_src->end.rtp_port = addr.sin_port;
|
||||
}
|
||||
return mgcp_send_rtp(proto, &addr, buf,
|
||||
len, conn_src, conn_src);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue