jolly has uploaded this change for review.
ASCI: Add new mode for voice group/broadcast call
The new mode "confecho" is similar to "sendrecv", except that it also
echoes back RTP towards the sender. This is required for voice group or
broadcast calls. Talker and listeners use the same timeslot, so that
audio must be echoed from the talker to the listeners.
It is different from "loopback", because a loopback only echoes back RTP
towards the sender, but does not forward audio through the endpoint to
the other connections. Also it does not forward RTP from senders of
other connections.
Because there is no transcoding within the endpoint, only one connection
in the mode "confecho" shall receive RTP from the sender.
The flags to send and receive RTP are removed from the mode "loopback",
because a connection in loopback mode does not send to, nor receive from
the endpoint. I just echoes RTP without any forwarding.
Change-Id: I0639c663e119d85bef1010c7aa45e2f133a9daf0
---
M include/osmocom/mgcp/mgcp_common.h
M src/libosmo-mgcp-client/mgcp_client.c
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_protocol.c
M tests/mgcp/mgcp_test.c
5 files changed, 36 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/46/33546/1
diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h
index 07d8d37..6f0775d 100644
--- a/include/osmocom/mgcp/mgcp_common.h
+++ b/include/osmocom/mgcp/mgcp_common.h
@@ -46,7 +46,8 @@
MGCP_CONN_RECV_ONLY = 1,
MGCP_CONN_SEND_ONLY = 2,
MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY,
- MGCP_CONN_LOOPBACK = 4 | MGCP_CONN_RECV_SEND,
+ MGCP_CONN_LOOPBACK = 4,
+ MGCP_CONN_CONFECHO = MGCP_CONN_LOOPBACK | MGCP_CONN_RECV_SEND,
};
#define MGCP_X_OSMO_IGN_HEADER "X-Osmo-IGN:"
diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index 78652a1..5df4560 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -1548,6 +1548,7 @@
{ MGCP_CONN_RECV_SEND, "sendrecv" },
{ MGCP_CONN_SEND_ONLY, "sendonly" },
{ MGCP_CONN_RECV_ONLY, "recvonly" },
+ { MGCP_CONN_CONFECHO, "confecho" },
{ MGCP_CONN_LOOPBACK, "loopback" },
{ 0, NULL }
};
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index 26a44c6..a46ffc2 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -75,7 +75,7 @@
}
/*! Parse connection mode.
- * \param[in] mode as string (recvonly, sendrecv, sendonly or loopback)
+ * \param[in] mode as string (recvonly, sendrecv, sendonly confecho or loopback)
* \param[in] endp pointer to endpoint (only used for log output)
* \param[out] associated connection to be modified accordingly
* \returns 0 on success, -1 on error */
@@ -100,6 +100,8 @@
conn->mode = MGCP_CONN_RECV_SEND;
else if (strcasecmp(mode, "sendonly") == 0)
conn->mode = MGCP_CONN_SEND_ONLY;
+ else if (strcasecmp(mode, "confecho") == 0)
+ conn->mode = MGCP_CONN_CONFECHO;
else if (strcasecmp(mode, "loopback") == 0)
conn->mode = MGCP_CONN_LOOPBACK;
else {
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 978af42..6223ffa 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1088,7 +1088,7 @@
/* check connection mode setting */
if (conn->conn->mode != MGCP_CONN_LOOPBACK
- && conn->conn->mode != MGCP_CONN_RECV_ONLY
+ && (conn->conn->mode & MGCP_CONN_SEND_ONLY)
&& osmo_sockaddr_port(&conn->end.addr.u.sa) == 0) {
LOGPCONN(_conn, DLMGCP, LOGL_ERROR,
"CRCX: selected connection mode type requires an opposite end!\n");
@@ -1296,7 +1296,7 @@
/* check connection mode setting */
if (conn->conn->mode != MGCP_CONN_LOOPBACK
- && conn->conn->mode != MGCP_CONN_RECV_ONLY
+ && (conn->conn->mode & MGCP_CONN_SEND_ONLY)
&& !mgcp_rtp_end_remote_addr_available(&conn->end)) {
LOGPCONN(conn->conn, DLMGCP, LOGL_ERROR,
"MDCX: selected connection mode type requires an opposite end!\n");
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index e37bb57..1caa879 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -712,9 +712,8 @@
/* Check that NONE disables all output */
OSMO_ASSERT((MGCP_CONN_NONE & MGCP_CONN_RECV_SEND) == 0);
- /* Check that LOOPBACK enables all output */
- OSMO_ASSERT((MGCP_CONN_LOOPBACK & MGCP_CONN_RECV_SEND) ==
- MGCP_CONN_RECV_SEND);
+ /* Check that LOOPBACK disables all output */
+ OSMO_ASSERT((MGCP_CONN_LOOPBACK & MGCP_CONN_RECV_SEND) == 0);
}
/* Extract a connection ID from a response and return in conn_id;
To view, visit change 33546. To unsubscribe, or for help writing mail filters, visit settings.