This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgPau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/14025
Change subject: mgcp-cli: Allow submitting X-Osmux on CRCX request
......................................................................
mgcp-cli: Allow submitting X-Osmux on CRCX request
Change-Id: I73b4c62baf39050da81d65553cbea07bc51163de
---
M include/osmocom/mgcp/mgcp_common.h
M include/osmocom/mgcp_client/mgcp_client.h
M include/osmocom/mgcp_client/mgcp_client_fsm.h
M src/libosmo-mgcp-client/mgcp_client.c
M src/libosmo-mgcp-client/mgcp_client_fsm.c
M tests/mgcp_client/mgcp_client_test.c
M tests/mgcp_client/mgcp_client_test.ok
7 files changed, 62 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/25/14025/1
diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h
index 75d5a37..a1bbb19 100644
--- a/include/osmocom/mgcp/mgcp_common.h
+++ b/include/osmocom/mgcp/mgcp_common.h
@@ -50,6 +50,7 @@
};
#define MGCP_X_OSMO_IGN_HEADER "X-Osmo-IGN:"
+#define MGCP_X_OSMO_OSMUX_HEADER "X-Osmux:"
/* Values should be bitwise-OR-able */
enum mgcp_x_osmo_ign {
diff --git a/include/osmocom/mgcp_client/mgcp_client.h b/include/osmocom/mgcp_client/mgcp_client.h
index 9b57f10..be84356 100644
--- a/include/osmocom/mgcp_client/mgcp_client.h
+++ b/include/osmocom/mgcp_client/mgcp_client.h
@@ -95,6 +95,7 @@
#define MGCP_MSG_PRESENCE_AUDIO_IP 0x0008
#define MGCP_MSG_PRESENCE_AUDIO_PORT 0x0010
#define MGCP_MSG_PRESENCE_CONN_MODE 0x0020
+#define MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID 0x4000
#define MGCP_MSG_PRESENCE_X_OSMO_IGN 0x8000
struct mgcp_msg {
@@ -113,6 +114,8 @@
struct ptmap ptmap[MGCP_MAX_CODECS];
unsigned int ptmap_len;
uint32_t x_osmo_ign;
+ bool x_osmo_osmux_use;
+ int x_osmo_osmux_cid; /* -1 is wildcard */
bool param_present;
struct mgcp_codec_param param;
};
diff --git a/include/osmocom/mgcp_client/mgcp_client_fsm.h b/include/osmocom/mgcp_client/mgcp_client_fsm.h
index e170a25..c763d74 100644
--- a/include/osmocom/mgcp_client/mgcp_client_fsm.h
+++ b/include/osmocom/mgcp_client/mgcp_client_fsm.h
@@ -48,6 +48,11 @@
* name than the BSC. An OsmoMGW will then ignore these and not fail on mismatches. */
uint32_t x_osmo_ign;
+ /*! send 'X-Osmux: %d' header (or "*" as wildcard). */
+ bool x_osmo_osmux_use;
+ /*! -1 means send wildcard. */
+ int x_osmo_osmux_cid;
+
/*! If left MGCP_CONN_NONE, use MGCP_CONN_RECV_ONLY or MGCP_CONN_RECV_SEND, depending on whether an audio RTP
* address is set. If != MGCP_CONN_NONE, force this conn mode. */
enum mgcp_connection_mode conn_mode;
diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index c28f5d2..bbef9ef 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -1104,6 +1104,7 @@
int rc = 0;
int rc_sdp;
bool use_sdp = false;
+ char buf[32];
msg->l2h = msg->data;
msg->cb[MSGB_CB_MGCP_TRANS_ID] = trans_id;
@@ -1207,6 +1208,15 @@
msgb_printf(msg, MGCP_X_OSMO_IGN_HEADER "%s\r\n",
mgcp_msg->x_osmo_ign & MGCP_X_OSMO_IGN_CALLID ? " C": "");
+ /* Add X-Osmo-Osmux */
+ if ((mgcp_msg->presence & MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID)) {
+ snprintf(buf, sizeof(buf), " %d", mgcp_msg->x_osmo_osmux_cid);
+ rc +=
+ msgb_printf(msg, MGCP_X_OSMO_OSMUX_HEADER "%s\r\n",
+ mgcp_msg->x_osmo_osmux_cid == -1 ? " *": buf);
+ }
+
+
/* Add session description protocol (SDP) */
if (use_sdp
&& (mgcp_msg->verb == MGCP_VERB_CRCX
diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c b/src/libosmo-mgcp-client/mgcp_client_fsm.c
index 75d583b..0d16720 100644
--- a/src/libosmo-mgcp-client/mgcp_client_fsm.c
+++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c
@@ -126,6 +126,11 @@
mgcp_msg->x_osmo_ign = info->x_osmo_ign;
mgcp_msg->presence |= MGCP_MSG_PRESENCE_X_OSMO_IGN;
}
+
+ if (info->x_osmo_osmux_use) {
+ mgcp_msg->x_osmo_osmux_cid = info->x_osmo_osmux_cid;
+ mgcp_msg->presence |= MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID;
+ }
}
static void add_audio(struct mgcp_msg *mgcp_msg, struct mgcp_conn_peer *info)
diff --git a/tests/mgcp_client/mgcp_client_test.c b/tests/mgcp_client/mgcp_client_test.c
index d610783..432a09c 100644
--- a/tests/mgcp_client/mgcp_client_test.c
+++ b/tests/mgcp_client/mgcp_client_test.c
@@ -157,6 +157,7 @@
.ptmap[0].pt = 96,
.ptmap_len = 1,
.x_osmo_ign = MGCP_X_OSMO_IGN_CALLID,
+ .x_osmo_osmux_cid = -1, /* wildcard */
};
if (mgcp)
@@ -254,6 +255,27 @@
msg = mgcp_msg_gen(mgcp, &mgcp_msg);
printf("%s\n", (char *)msg->data);
+ printf("Generate X-Osmo-Osmux message:\n");
+ msg = mgcp_msg_gen(mgcp, &mgcp_msg);
+ mgcp_msg.verb = MGCP_VERB_CRCX;
+ mgcp_msg.presence =
+ (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID |
+ MGCP_MSG_PRESENCE_CONN_ID | MGCP_MSG_PRESENCE_CONN_MODE
+ | MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID);
+ msg = mgcp_msg_gen(mgcp, &mgcp_msg);
+ printf("%s\n", (char *)msg->data);
+
+ printf("Generate X-Osmo-Osmux message (fixed CID 2):\n");
+ msg = mgcp_msg_gen(mgcp, &mgcp_msg);
+ mgcp_msg.verb = MGCP_VERB_CRCX;
+ mgcp_msg.x_osmo_osmux_cid = 2;
+ mgcp_msg.presence =
+ (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID |
+ MGCP_MSG_PRESENCE_CONN_ID | MGCP_MSG_PRESENCE_CONN_MODE
+ | MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID);
+ msg = mgcp_msg_gen(mgcp, &mgcp_msg);
+ printf("%s\n", (char *)msg->data);
+
printf("Overfolow test:\n");
mgcp_msg.verb = MGCP_VERB_MDCX;
mgcp_msg.presence =
diff --git a/tests/mgcp_client/mgcp_client_test.ok b/tests/mgcp_client/mgcp_client_test.ok
index 65b5298..8fbe3ae 100644
--- a/tests/mgcp_client/mgcp_client_test.ok
+++ b/tests/mgcp_client/mgcp_client_test.ok
@@ -84,6 +84,22 @@
M: sendrecv
X-Osmo-IGN: C
+Generate X-Osmo-Osmux message:
+CRCX 13 23 at mgw MGCP 1.0
+C: 2f
+I: 11
+L: p:20, a:GSM, nt:IN
+M: sendrecv
+X-Osmux: *
+
+Generate X-Osmo-Osmux message (fixed CID 2):
+CRCX 15 23 at mgw MGCP 1.0
+C: 2f
+I: 11
+L: p:20, a:GSM, nt:IN
+M: sendrecv
+X-Osmux: 2
+
Overfolow test:
--
To view, visit https://gerrit.osmocom.org/14025
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I73b4c62baf39050da81d65553cbea07bc51163de
Gerrit-Change-Number: 14025
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190513/427faaaf/attachment.htm>