gsm0808: Introduce Osmocom extensions to announce Osmux support
IE GSM0808_IE_OSMO_OSMUX_SUPPORT (T, 1 byte) is sent in AoIP appended to
BSSMAP RESET in order to announce the peer that its MGW supports handling
Osmux streams upon call set up.
IE GSM0808_IE_OSMO_OSMUX_CID (TV, T 1 byte & V 1 byte) is sent in AoIP
during call set up:
* MSC->BSC Assignment Request
* BSC->MSC Assignemnt Complete
The 1 byte value contains the local Osmux CID, aka the recvCID aka CID where the
peer sending the Assign Req/Compl will look for Osmux frames on that
call. Hence, the peer receiving this CID value must use it to send Osmux
frames for that call.
As a result, a given call leg BSC<->MSC can have one different Osmux CID
per direction. For example:
* MS => MGW_BSC ==CID 0==> MGW_MSC
* MS <= MGW_BSC <=CID 1=== MGW_MSC
This allows for setups with 256 call legs per BSC on scenarios where NAT
is not a problem, where MSC can have a pool of 256 CID per MGW_BSC (or
remote peer).
Related: OS#2551
Change-Id: I28f83e2e32b9533c99e65ccc1562900ac2aec74e
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index e825930..26f7944 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -172,6 +172,25 @@
return (int)(elem - old_elem);
}
+/*! Decode TS 08.08 (Osmocom Extension) Osmux CID
+ * TV with len(V) == 1, and V is the CID to be used.
+ * \param[out] cid Caller-provided variable where CID is stored
+ * \param[in] elem pointer to IE value
+ * \param[in] len length of \a elem in bytes
+ * \returns number of bytes parsed */
+int gsm0808_dec_osmux_cid(uint8_t *cid, const uint8_t *elem, uint8_t len)
+{
+ OSMO_ASSERT(cid);
+ if (!elem)
+ return -EINVAL;
+ if (len != 1)
+ return -EINVAL;
+
+ *cid = *elem;
+
+ return 1;
+}
+
#endif /* HAVE_SYS_SOCKET_H */
/* Helper function for gsm0808_enc_speech_codec()