mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-03 13:33:29 +00:00
mgcp: Implement the "loopback" mode for a connection endpoint.
This commit is contained in:
@@ -28,6 +28,15 @@
|
|||||||
|
|
||||||
#define CI_UNUSED 0
|
#define CI_UNUSED 0
|
||||||
|
|
||||||
|
enum mgcp_connection_mode {
|
||||||
|
MGCP_CONN_NONE = 0,
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct mgcp_endpoint {
|
struct mgcp_endpoint {
|
||||||
int ci;
|
int ci;
|
||||||
char *callid;
|
char *callid;
|
||||||
|
|||||||
@@ -206,6 +206,10 @@ static int rtp_data_cb(struct bsc_fd *fd, unsigned int what)
|
|||||||
if (cfg->audio_loop)
|
if (cfg->audio_loop)
|
||||||
dest = !dest;
|
dest = !dest;
|
||||||
|
|
||||||
|
/* Loop based on the conn_mode, maybe undoing the above */
|
||||||
|
if (endp->conn_mode == MGCP_CONN_LOOPBACK)
|
||||||
|
dest = !dest;
|
||||||
|
|
||||||
if (dest == DEST_NETWORK) {
|
if (dest == DEST_NETWORK) {
|
||||||
if (proto == PROTO_RTP)
|
if (proto == PROTO_RTP)
|
||||||
patch_and_count(&endp->bts_seq_no, &endp->bts_lost_no,
|
patch_and_count(&endp->bts_seq_no, &endp->bts_lost_no,
|
||||||
|
|||||||
@@ -38,13 +38,6 @@
|
|||||||
#include <openbsc/mgcp.h>
|
#include <openbsc/mgcp.h>
|
||||||
#include <openbsc/mgcp_internal.h>
|
#include <openbsc/mgcp_internal.h>
|
||||||
|
|
||||||
enum mgcp_connection_mode {
|
|
||||||
MGCP_CONN_NONE = 0,
|
|
||||||
MGCP_CONN_RECV_ONLY = 1,
|
|
||||||
MGCP_CONN_SEND_ONLY = 2,
|
|
||||||
MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro for tokenizing MGCP messages and SDP in one go.
|
* Macro for tokenizing MGCP messages and SDP in one go.
|
||||||
*
|
*
|
||||||
@@ -364,6 +357,8 @@ static int parse_conn_mode(const char* msg, int *conn_mode)
|
|||||||
*conn_mode = MGCP_CONN_RECV_ONLY;
|
*conn_mode = MGCP_CONN_RECV_ONLY;
|
||||||
else if (strcmp(msg, "sendrecv") == 0)
|
else if (strcmp(msg, "sendrecv") == 0)
|
||||||
*conn_mode = MGCP_CONN_RECV_SEND;
|
*conn_mode = MGCP_CONN_RECV_SEND;
|
||||||
|
else if (strcmp(msg, "loopback") == 0)
|
||||||
|
*conn_mode = MGCP_CONN_LOOPBACK;
|
||||||
else {
|
else {
|
||||||
LOGP(DMGCP, LOGL_ERROR, "Unknown connection mode: '%s'\n", msg);
|
LOGP(DMGCP, LOGL_ERROR, "Unknown connection mode: '%s'\n", msg);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user