pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29861 )
Change subject: Rename and move func checking if amr mode is explicitly configured
......................................................................
Rename and move func checking if amr mode is explicitly configured
The previous naming was quite confusing, since the function is not
really checking whether a conversion is needed, but rather whether the
codec has the AMR RTP mode defined explicitly and hence forced.
The previous naming didn't harm because the amr_oa_bwe_convert also
supports the conversion path OA<->OA and BE<->BE.
Hence nowadays the amr_oa_bwe_convert() function is called always if the
dst conn has its codec with AMR RTP mode explicitly set, no matter if
the src and dst conn have the same mode.
Related: SYS#6161
Change-Id: I8dce3038ebccf5e1e37e2908070a67d66693a96f
---
M include/osmocom/mgcp/mgcp_codec.h
M src/libosmo-mgcp/mgcp_codec.c
M src/libosmo-mgcp/mgcp_network.c
3 files changed, 15 insertions(+), 16 deletions(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
diff --git a/include/osmocom/mgcp/mgcp_codec.h b/include/osmocom/mgcp/mgcp_codec.h
index 97e6b8d..994d770 100644
--- a/include/osmocom/mgcp/mgcp_codec.h
+++ b/include/osmocom/mgcp/mgcp_codec.h
@@ -17,4 +17,5 @@
int mgcp_codec_pt_translate(struct mgcp_conn_rtp *conn_src, struct mgcp_conn_rtp *conn_dst, int payload_type);
const struct mgcp_rtp_codec *mgcp_codec_pt_find_by_subtype_name(struct mgcp_conn_rtp *conn,
const char *subtype_name, unsigned int match_nr);
+bool mgcp_codec_amr_align_mode_is_indicated(const struct mgcp_rtp_codec *codec);
bool mgcp_codec_amr_is_octet_aligned(const struct mgcp_rtp_codec *codec);
diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c
index 38aa0a7..1a8d26a 100644
--- a/src/libosmo-mgcp/mgcp_codec.c
+++ b/src/libosmo-mgcp/mgcp_codec.c
@@ -345,6 +345,18 @@
return -EINVAL;
}
+/* Check if the codec has a specific AMR mode (octet-aligned or bandwith-efficient) set. */
+bool mgcp_codec_amr_align_mode_is_indicated(const struct mgcp_rtp_codec *codec)
+{
+ if (codec->param_present == false)
+ return false;
+ if (!codec->param.amr_octet_aligned_present)
+ return false;
+ if (strcmp(codec->subtype_name, "AMR") != 0)
+ return false;
+ return true;
+}
+
/* Return true if octet-aligned is set in the given codec. Default to octet-aligned=0, i.e. bandwidth-efficient mode.
* See RFC4867 "RTP Payload Format for AMR and AMR-WB" sections "8.1. AMR Media Type Registration" and "8.2. AMR-WB
* Media Type Registration":
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 55f49c4..26f3475 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -769,20 +769,6 @@
return msgb_trim(msg, rc + sizeof(struct rtp_hdr));
}
-/* Check if a conversion between octet-aligned and bandwith-efficient mode is
- * indicated. */
-static bool amr_oa_bwe_convert_indicated(struct mgcp_rtp_codec *codec)
-{
- if (codec->param_present == false)
- return false;
- if (!codec->param.amr_octet_aligned_present)
- return false;
- if (strcmp(codec->subtype_name, "AMR") != 0)
- return false;
- return true;
-}
-
-
/* Return whether an RTP packet with AMR payload is in octet-aligned mode.
* Return 0 if in bandwidth-efficient mode, 1 for octet-aligned mode, and negative if the RTP data is invalid. */
static int amr_oa_check(char *data, int len)
@@ -1221,7 +1207,7 @@
if (mgcp_conn_rtp_is_iuup(conn_dst) || mgcp_conn_rtp_is_iuup(conn_src)) {
/* the iuup code will correctly transform to the correct AMR mode */
- } else if (amr_oa_bwe_convert_indicated(conn_dst->end.codec)) {
+ } else if (mgcp_codec_amr_align_mode_is_indicated(conn_dst->end.codec)) {
rc = amr_oa_bwe_convert(endp, msg,
conn_dst->end.codec->param.amr_octet_aligned);
if (rc < 0) {
@@ -1535,7 +1521,7 @@
* defined, then we check if the incoming payload matches that
* expectation. */
if (mc->proto == MGCP_PROTO_RTP &&
- amr_oa_bwe_convert_indicated(conn_src->end.codec)) {
+ mgcp_codec_amr_align_mode_is_indicated(conn_src->end.codec)) {
int oa = amr_oa_check((char*)msgb_data(msg), msgb_length(msg));
if (oa < 0)
return -1;
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29861
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I8dce3038ebccf5e1e37e2908070a67d66693a96f
Gerrit-Change-Number: 29861
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29875 )
Change subject: sccplite: Use mgwpool config to set up socket forwarding IPA-MGCP from MSC to MGW
......................................................................
Patch Set 1:
(1 comment)
File src/osmo-bsc/osmo_bsc_msc.c:
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-435):
https://gerrit.osmocom.org/c/osmo-bsc/+/29875/comment/bd33a416_ddd30f48
PS1, Line 167: struct mgcp_client * mgcp_cli;
"foo * bar" should be "foo *bar"
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29875
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If105dee52b8d36161c759f979eaef4579b47d365
Gerrit-Change-Number: 29875
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Wed, 26 Oct 2022 09:36:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29875 )
Change subject: sccplite: Use mgwpool config to set up socket forwarding IPA-MGCP from MSC to MGW
......................................................................
sccplite: Use mgwpool config to set up socket forwarding IPA-MGCP from MSC to MGW
In SCCPlite, the BSC receives the CN-side MGCP from the MSC through an
IPA conn, and it then forwards those messages to its co-located MGW
through a rawUDP socket created at startup.
This forwarding UDP socket still relied exclusively on the "mgw.conf"
struct which was filled only by the old VTY interface which was been
deprecated lately.
This patch moves the mgw-pool setup before the msc setup so that if the
VTY config file still uses the old VTY, the single MGW is added to the
MGW pool through mgcp_client_pool_register_single(). It then simply
picks the first available MGW from the pool when creating the raw UDP
MGCP-forwarding socket.
This means SCCPLite is still left with supporting only 1 MGW. If more
than one MGW is defined in the pool, then when the call is being set up
a different MGW could be picked from the pool while the CN-side MGCP
would still be sent to the MGW pool selected at osm-bsc startup.
This limitation coul be removed later on by adding a new VTY command
under the "msc" to pin calls for an MSC to an MGW with a given "mgw_nr"
from the pool, and that same MGW be looked for in the pool every time a
new call is being established.
Another possibility would be to avoid creating the "connected" UDP
socket at osmo-bsc startup, and rather use it in non-connected mode and
transmit (sendto) using the mgcp_client remote address during call
establishment.
In any case, this is left as future excercise since so far there hasn't
been any need for multiple MGWs in SCCPLite setups.
Related: SYS#5987
Change-Id: If105dee52b8d36161c759f979eaef4579b47d365
---
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc/osmo_bsc_msc.c
2 files changed, 16 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/75/29875/1
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 863ceea..dd8e696 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -989,6 +989,9 @@
}
}
+ if (bsc_mgw_setup() != 0)
+ exit(1);
+
llist_for_each_entry(msc, &bsc_gsmnet->mscs, entry) {
if (osmo_bsc_msc_init(msc) != 0) {
LOGP(DMSC, LOGL_ERROR, "Failed to start up. Exiting.\n");
@@ -996,9 +999,6 @@
}
}
- if (bsc_mgw_setup() != 0)
- exit(1);
-
if (osmo_bsc_sigtran_init(&bsc_gsmnet->mscs) != 0) {
LOGP(DNM, LOGL_ERROR, "Failed to initialize sigtran backhaul.\n");
exit(1);
diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c
index 1dd486f..a584f46 100644
--- a/src/osmo-bsc/osmo_bsc_msc.c
+++ b/src/osmo-bsc/osmo_bsc_msc.c
@@ -40,6 +40,7 @@
#include <osmocom/abis/ipa.h>
#include <osmocom/mgcp_client/mgcp_client.h>
+#include <osmocom/mgcp_client/mgcp_client_pool.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
@@ -163,27 +164,32 @@
int osmo_bsc_msc_init(struct bsc_msc_data *msc)
{
struct gsm_network *net = msc->network;
- uint16_t mgw_port;
+ struct mgcp_client * mgcp_cli;
int rc;
/* Everything below refers to SCCP-Lite MSC connections only. */
if (msc_is_aoip(msc))
return 0;
- if (net->mgw.conf->remote_port >= 0)
- mgw_port = net->mgw.conf->remote_port;
- else
- mgw_port = MGCP_CLIENT_REMOTE_PORT_DEFAULT;
-
+ /* Note: MGW is preselected here at startup, which means currently
+ * osmo-bsc configured for SCCPLite doesn't support MGW pools with more
+ * than 1 MGW.
+ */
+ mgcp_cli = mgcp_client_pool_get(net->mgw.mgw_pool);
+ OSMO_ASSERT(mgcp_cli);
rc = osmo_sock_init2_ofd(&msc->mgcp_ipa.ofd, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP,
msc->mgcp_ipa.local_addr, msc->mgcp_ipa.local_port,
- net->mgw.conf->remote_addr, mgw_port,
+ mgcp_client_remote_addr_str(mgcp_cli),
+ mgcp_client_remote_port(mgcp_cli),
OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT);
+ mgcp_client_pool_put(mgcp_cli);
if (rc < 0) {
LOGP(DMSC, LOGL_ERROR, "msc %u: Could not create/connect/bind MGCP proxy socket: %d\n",
msc->nr, rc);
return rc;
}
+ LOGP(DMSC, LOGL_INFO, "msc %u: Socket forwarding IPA-encapsulated MGCP messages towards MGW: %s\n",
+ msc->nr, osmo_sock_get_name2(msc->mgcp_ipa.ofd.fd));
return 0;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29875
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If105dee52b8d36161c759f979eaef4579b47d365
Gerrit-Change-Number: 29875
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: pespin.
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29873 )
Change subject: osmux: Rename function and pass msgb directly to it
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29873
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I8c0121485d0c96f70fe8bcbdb150793d428183ff
Gerrit-Change-Number: 29873
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 26 Oct 2022 09:27:05 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: neels, pespin.
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29864 )
Change subject: mgw: rx_rtp(): reorder checks and handlings
......................................................................
Patch Set 3: Code-Review+2
(1 comment)
Commit Message:
https://gerrit.osmocom.org/c/osmo-mgw/+/29864/comment/27a66f10_a3a65af8
PS1, Line 9: Let's first validate the origin of the message, then the content of the
> I'd say the imperative form is specially useful in the first line since it needs to be short. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29864
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I011a6d7d705768c32a35cec5cd7169725a21a670
Gerrit-Change-Number: 29864
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 26 Oct 2022 09:23:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment