7060 Commits

Author SHA1 Message Date
Oliver Smith
7d236cca56 Generate a version.h file
Related: OS#6626
Change-Id: I8460e85d50149f4bc58b6048e5596c5768010829
2025-06-23 16:48:06 +02:00
Pau Espin Pedrol
2fdedc0715 mgw: osmux: Fix heap-use-after-free
As found by Asan on a osmo-mgw running in production:
"""
 ==2238035==ERROR: AddressSanitizer: heap-use-after-free on address 0x62100043bdca at pc 0x7f9bcebaa070 bp 0x7ffcb08f2150 sp 0x7ffcb08f2148
 READ of size 2 at 0x62100043bdca thread T0
     #0 0x7f9bcebaa06f in msgb_length src/core/msgb.c:287
     #1 0x55869457a8ff in conn_osmux_send_rtp src/libosmo-mgcp/mgcp_osmux.c:245
     #2 0x558694563a86 in mgcp_dispatch_rtp_bridge_cb src/libosmo-mgcp/mgcp_network.c:1347
     #3 0x5586945570a9 in rx_rtp src/libosmo-mgcp/mgcp_network.c:1550
     #4 0x5586945570a9 in rtp_recvfrom_cb src/libosmo-mgcp/mgcp_network.c:1505
     #5 0x7f9bcebc96cc in iofd_poll_ofd_cb_recvmsg_sendmsg src/core/osmo_io_poll.c:84
     #6 0x7f9bcebcb699 in iofd_poll_ofd_cb_dispatch src/core/osmo_io_poll.c:136
     #7 0x7f9bcebd7df5 in poll_disp_fds src/core/select.c:419
     #8 0x7f9bcebd7df5 in _osmo_select_main src/core/select.c:457
     #9 0x7f9bcebd8298 in osmo_select_main src/core/select.c:496
     #10 0x558694534f2e in main src/osmo-mgw/mgw_main.c:428
"""

Related: SYS#7450
Change-Id: Id90c77aaf44422c3ed70ffb06560537e920a468c
2025-04-25 13:48:46 +02:00
Pau Espin Pedrol
4a09ace3b4 mgw: Update RTP local address on E1 endpoints too
E1 endpoints still have usually 1 RTP connection on it (they do
E1-slot<->RTP), so we still need to update the RTP addr+port binding
upon CRCX & MDCX on those endpoints.

This fixes a recent regression with setups with E1 BTS failing to
establish calls.

Fixes: b317b0056a
Change-Id: I52e91cd2d9d4b64961b76bb0fecc82494ca0d7cb
2025-03-18 11:19:45 +01:00
Pau Espin Pedrol
12c45577bb mgw: iuup: Trigger Init on CN-side CRCX if RAN-side was already initialized
Prior to this patch, osmo-mgw would wait until first IuUP Data frame
would be received on RAN-side (from HNB) to trigger active
initialization (Tx IuUP-Init) on CN-side conn towards CN.
With this patch, this happens ASAP, whenever the CN-side conn is created
by HNBGW when it receives the RAB-ASS-RESP from HNB.

Related: OS#6685
Change-Id: Iab0af88852994e73bfe6c3b27fe196fd655cce03
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
b317b0056a mgw: Move endpoint/conn updating logic to helper function
Move code logic doing actions based on endpoint state (and its conns)
out of the CRCX/MDCX MGCP handlers.
Most of that logic present in CRCX and MDCX is actually the same and can
be merged.
This way we can also make the updating logic more complex without
extending the CRCX/MDCX handlers for and more adding spaghetti code.

Change-Id: I24dd15ec76bd6e949a178a3b998b76a44ddbab50
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
a4ebbf7dbe mgw: mdcx: Fix inc of non-existing ctr in mdcx counter group
Change-Id: If849e3922c7ae864771c41ff7c0fac37ef0280de
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
8b23fb916a mgw: Rearrange last steps of CRCX and MDCX
Make code in CRCX and MDCX look closer, since it is really doing the
same.
Move the dummy ping code after everything has been done correctly, since
the ping is just a side effect of the conn being created.

Change-Id: I42acda16cb2d59a9b7aae06b7584d4dfc1e91f9e
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
c3ff38ee4c mgw: Drop rtp_processing transcoding stubs
This has never been used afaik, and it's only clogging the code and
adding extra indirect function pointer calls to hot paths for no good
reason.
Drop all of it, and re-ad whatever makes sense once someone really wants
to implement transcoding.

Change-Id: Id16af528d94612e771f94333ad5404e5cd1c3318
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
eeee783db2 mgw: CRCX: Handle codec information before initializing osmux
Same order as done during MDCX. This way we can also eg. check
configured codec is AMR before successfully entering configuring osmux.

Change-Id: If291db0c048196e6e0eee2c38e648e5a25438078
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
436f4dee17 mgw: Split DLCX read-only validations into its own function
Similar to what's already done in CRCX and MDXC.

Change-Id: I3d86f0cbeacc7c0cd69809f898714a76d3b86ed0
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
ea4aa7d3c1 mgw: Split MDCX read-only validation on conn into its own function
Add a second read-only validation step once the conn to be modified is
found in the endpoint.

Change-Id: I025ca5352eff9ee35c977c69b71934513646b1f2
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
2140c20a0b mgw: Split MDCX read-only validations into its own function
The SDP parsing is moved to a step beforehand, so that validation of
full message can be done in a subsequent step. That validation step is
moved into a function to give some air to handle_modify_con() and easily
spot the logic.

Change-Id: I469413dbe89cc4795deb50d76b434655cba9b776
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
485e085140 mgw: Increment rate_ctr MGCP_*_FAIL_UNHANDLED_PARAM during parsing
We could not do it before because we had no easy access to the command
verb being parsed. Now that we have access to it, bettter increase it
where we have exact path where stuff happens.

Change-Id: I3ea45fc1d25284b253ac9b7f0c0a925c10c994ca
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
c8b8106cb5 mgw: Split CRCX read-only validations into its own function
The SDP parsing is moved to a step beforehand, so that validation of
full message can be done in a subsequent step. That validation step is
moved into a function to give some air to handle_create_con() and easily
spot the logic.

The logic based on force_realloc is split so that code modifying the
object is moved to the later update step.

Change-Id: I639ad0a25a0af4a4637045ca8bf61e436a789426
2025-03-11 11:13:02 +01:00
Pau Espin Pedrol
c506ded3dd mgw: Split MGCP LocalConnectionOptions parsing from updating endpoint
Split current code into 2 steps, so first read-only parsing can be done,
then when all parsing and checks have been done, finally can be applied
o the object.

Change-Id: If75731fb92329dca6d092ffc7ff17cb354d28c0d
2025-03-11 10:12:29 +00:00
Mychaela N. Falconia
e96ad8f422 E1: implement dummy fill for HRv1 codec
In the absence of a proper TFO transform (TS 28.062 section
C3.2.1.1), OsmoMGW-E1 inserts constant fill frames when there is
no RTP input, or when RTP input fails conversion to TRAU-DL and
thus does not enqueue anything to the I.460 mux.

This dummy fill was previously implemented for FR and EFR codecs,
but not for HRv1.  Fix this omission.

With this change and with a fix to OsmoBSC to select 8k subslot
endpoints for TCH/H instead of 16k, OsmoMGW-E1 now supports HR
codec to the same degree to which it supports FR and EFR: far from
perfect, but mostly usable, especially if DTXu is disabled
and there is no TrFO interworking with a far end that does DTXu.

Change-Id: I188bc0a0468b19126281016f45e36f1de617e9ee
2025-03-10 19:26:57 +00:00
Mychaela N. Falconia
9253bb193f E1: change dummy fill frame generation method
In the absence of a proper TFO transform (TS 28.062 section
C3.2.1.1), OsmoMGW-E1 inserts constant fill frames when there is
no RTP input, or when RTP input fails conversion to TRAU-DL and
thus does not enqueue anything to the I.460 mux.  (We accept
TW-TS-001 and TW-TS-002 from RTP side, but bad frames cannot be
converted to TRAU-DL without a TFO transform.)

Prior to the present change, this idle fill of the DL was done
using fully hard-coded frames, i.e., the operation of converting
the desired fill to TRAU-DL bit format was done once externally
and the raw bit frames were hard-coded.  Change this approach:
use fill frames in RTP format provided by libosmocodec, and
execute osmo_rtp2trau() followed by osmo_trau_frame_encode() in
the fill frame output path just like we do for regular RTP to DL.

Depends: libosmocore.git I2c510ac62a0786c137115c45eee7a48b9736265f
Change-Id: I123f77295c56d61ff9aac5f5d64b25eca01e0d63
2025-03-10 19:26:57 +00:00
Mychaela N. Falconia
6018cc4d8a MGCP extension: add parameters for TW-TS-001 & TW-TS-002
TW-TS-001 and TW-TS-002 are enhanced RTP transport formats for
GSM FR/HR/EFR codecs that restore the lost semantics of GSM 08.60
and 08.61 TRAU-UL frames.

TW-TS-003 BSSMAP extension provides a way for a core network to
ask the BSS to use these TRAU-like enhanced RTP formats instead of
those specified in 3GPP TS 48.103; OsmoBSC already supports this
mechanism when the BSS is comprised of IP-native OsmoBTS.

However, in order to achieve the same effect when using E1-based
legacy BTS hardware, the task of generating TW-TS-001/002 RTP
packets for UL and accepting them for DL moves from OsmoBTS to
the E1-Abis-interfacing MGW.  osmo_trau2rtp() is already capable
of generating these extended RTP formats on request, but until now
there was no mechanism to signal from OsmoBSC to its associated
E1 Abis MGW whether and when these extensions should be used.

Considering that MGCP as it is used in Osmocom is essentially a
private interface between OsmoBSC or OsmoMSC masters and OsmoMGW
slaves, while the externally defined and generally interoperable
interface is 3GPP TS 48.008, possibly extended with TW-TS-003,
the sensible solution is to make a private extension to the way
FR, EFR and HR codecs are described in SDP in the context of
Osmocom-MGCP.

The SDP extension birthed in the present patch consists of an fmtp
parameter for GSM, GSM-EFR and GSM-HR-08 codecs that is structured
just like the already implemented octet-align parameter for AMR.
TW-TS-001 for FR and EFR shall be described as follows:

m=audio 1234 RTP/AVP 3 110
a=rtpmap:3 GSM/8000/1
a=fmtp:3 tw-ts-001=1
a=rtpmap:110 GSM-EFR/8000/1
a=fmtp:110 tw-ts-001=1

TW-TS-002 for HR codec shall be described as follows:

m=audio 1234 RTP/AVP 111
a=rtpmap:111 GSM-HR-08/8000/1
a=fmtp:111 tw-ts-002=1

The present patch affects two areas:

* Experimental support for the newly defined extension is added to
  OsmoMGW-E1.  This support is deemed experimental (not for
  production use) because even with this extension added, OsmoMGW-E1
  is still unable to satisfy ThemWi requirements: neither ThemWi
  RTP endpoint library nor the TFO transform of TS 28.062 section
  C.3.2.1.1 are currently available in the repertoire of libraries
  whose use is allowed in mainline OsmoCNI components, yet both are
  required.

* Support is added to libosmo-mgcp-client whereby OsmoBSC will be
  able to issue CRCX and MDCX commands to E1 Abis MGW endpoints
  with TW-TS-001 and/or TW-TS-002 enabled.  Adding the necessary
  support to OsmoBSC will allow a complete working system to be
  deployed using OsmoBSC plus tw-e1abis-mgw, a replacement for
  OsmoMGW-E1 that works by using both Osmocom and ThemWi libraries.

Related: OS#6614
Change-Id: I0d58e6d84418f50670c8ab7cf8490af3bc2f5c26
2025-03-10 19:26:57 +00:00
Pau Espin Pedrol
6d629768c7 mgw: Allocate req and pdata with talloc
This will allow allocating parsed objects as child of the request and
make sure they are freed after handling the request finishes.
Change-Id: I2b971d0c8268f4c0a30b84b54a2e5f16ada4ecdb
2025-03-10 12:17:53 +00:00
Pau Espin Pedrol
5ec1c13221 mgw: Use tall_mgw_ctx to allocate struct mgcp_config
Change-Id: Ib51f1066bb73da4472bd8967cc1b1c44e964e9e5
2025-03-10 12:17:53 +00:00
Pau Espin Pedrol
f63ef75d9f mgw: Add backpointer from pdata to req to have context available
This will also allow eg. parsing/validating differently based on the
command being parsed, or incrementing rate counters per cmd group.

Change-Id: I464258ca1a8817d58ae5c5426dfc3b7cee6763d3
2025-03-10 12:17:53 +00:00
Pau Espin Pedrol
741d0ece37 mgw: Move cfg pointer from pdata to rq
The externa object context is held in rq object, not in pdata object,
which holds parsed msg state only.

Change-Id: Ie64fb6250cc84f1e7737b5c1cf5cca314c7020ed
2025-03-10 12:17:53 +00:00
Pau Espin Pedrol
60eaa0d909 mgw: Move struct mgcp_request_data definition to header file
All the related handling structs are placed in the header file, let's
move them there. This will also allow accessing the rq object
information in other files.

Change-Id: I1b2831874c1aaad054ad19bf87646062ba9d4da4
2025-03-10 12:17:53 +00:00
Pau Espin Pedrol
8d9d1d5e72 mgw: Store Command as enum in struct mgcp_request_data
This simplifies code further, and will simpify more code since we'll
have some easy way to check for the command we are in during a request.

Change-Id: I2d4b5ddb93376b59413b34c9668c41157ab05497
2025-03-10 12:17:53 +00:00
Pau Espin Pedrol
533cf424e7 mgw: Delay osmux trunk setup to point where it is really needed
This way code is simplified by putting all osmux code together.

Change-Id: I27f7355ee99f1781fc2034a23c7cca756fb203d2
2025-03-10 12:17:53 +00:00
Pau Espin Pedrol
6f4cd1b7e1 mgw: Validate CallID before updating endp->x_osmo_ign
This allows already starting to mark a clear line in CRCX handling
function between *read-only parsing + validation* and *read-write
allocation and update* of objects.

This in turn will allow further clean up on the second mentioned step.

Change-Id: Ia41f7383171bb24f48297456935c633536aa7b05
2025-03-10 12:17:53 +00:00
Mychaela N. Falconia
9d719b5d96 cosmetic: add copy of mgcp_common.h to .gitignore
The build process copies include/osmocom/mgcp/mgcp_common.h to
include/osmocom/mgcp_client/mgcp_common.h; the former is a true
source while the latter is a build-generated file.  The copied
file needs to be included in .gitignore, otherwise it adds
noise to git status output.

Change-Id: Icf0e3f724564d87eef9351b22de7a3d3aa7e4264
2025-03-07 16:20:12 +00:00
Pau Espin Pedrol
79fd5a4f47 mgw: Early reject CRCX with X-Osmux if disabled by config
This new behavior rejects the CRCX before creating a conn, simplifying
the code and also allows getting rid of the remote_osmux_cid local variable.

Change-Id: I0245b6c02bf7a3452532e8bf0d7c33479999ce9f
2025-03-06 16:55:31 +01:00
Pau Espin Pedrol
5d0080b69d cosmetic: Drop incorrect comment
The writer of this commit wrongly interpreted conn->end to be an
mgcp_endpoint, but it's actually an struct mgcp_rtp_end, hence codecs
are set per connection as expected.

Change-Id: I773065972342b8cedc900e3d194c48775c3adb5a
2025-03-06 16:33:20 +01:00
Pau Espin Pedrol
43279942c3 Drop use of deprecated vty is_config_node() cb
This callback was drepecated and is not ever called since
libosmocore.git 70ce871532ab21955e0955d7e230eae65438f047 (release 1.3.0).

See also libosmocore.git d31de237582f6fe3315d61bb9a488d4cda92654e.

Change-Id: Ifdecb35f329c243222bc5d77f0a6d394c9413684
2025-03-04 18:16:49 +01:00
Oliver Smith
2eacae8f2e Bump version: 1.13.1.41-403d5-dirty → 1.14.0
Change-Id: Ib6f5b6ee771adb967fa6cebae03c519839693566
1.14.0
2025-02-12 12:32:06 +01:00
Mychaela N. Falconia
403d5f1489 E1: replace idle_tf_fr[] with a better version
The only truly correct way to pass FR/HR/EFR traffic from an
incoming RTP stream to TRAU-DL frames is to apply the transform
of TS 28.062 section C.3.2.1.1, originally specified for TFO
but also necessary in the non-3GPP-specified case of GSM TrFO
as it happens here.  Unlike the situation with EFR, a FOSS
implementation of TFO transform for FRv1 does exist in Themyscira
libgsmfr2 - however, making these Themyscira codec libraries
usable from mainline Osmocom programs by way of a proposed
libosmocore DSO plugin mechanism, followed by a major redesign
of OsmoMGW-E1 to pass all DL traffic through this TFO transform,
would be a major project, difficult to justify prior to development
of a proper TFO transform for EFR to complement the one for FRv1.
Hence no change is being made currently to the arguably flawed
general architecture of OsmoMGW-E1, which consists of passing
through unaltered all valid codec frames that are received in RTP,
and inserting fixed dummy TRAU-DL frames when no RTP-derived ones
are available.

The original dummy TRAU-DL frame for FRv1 exhibited the following
defects:

* The payload frame transmitted to the MS consisted of all zero
  bits.  Standard type-approved GSM MS would interpret this bit
  pattern as a SID frame, even though the BTS is told via C16 bit
  "this frame is not a SID".  Passing a SID is not inherently bad
  in itself in this context, but a SID with all LARc parameters
  set to 0 is a strange/poor choice.

* The setting of C-bits (defined in TS 48.060 section 5.5.1.1.1)
  was a mish-mash between TRAU-UL and TRAU-DL frame formats,
  thereby not matching the standard TRAU-DL C-bits fill produced
  by osmo_rtp2trau().

The replacement fill frame introduced here differs as follows:

* The payload bit content is the silence frame of GSM 46.011
  Table 1: certainly better than a SID with all LARc parameters
  set to 0, and arguably better than any SID at all.

* The full TRAU-DL frame (C-bits pattern, peculiar ordering of
  D-bits) was generated by passing said silence frame through
  osmo_rtp2trau(), using this ad hoc tool:

https://gitea.osmocom.org/themwi/dummy-dl-frames

Change-Id: I995824586058e4e4ed77e900d4b57e5113f9eff6
2025-02-05 21:37:23 +00:00
Mychaela N. Falconia
f227633959 E1: replace idle_tf_efr[] with a better version
The only truly correct way to pass FR/HR/EFR traffic from an
incoming RTP stream to TRAU-DL frames is to apply the transform
of TS 28.062 section C.3.2.1.1, originally specified for TFO
but also necessary in the non-3GPP-specified case of GSM TrFO
as it happens here.  However, no FOSS or even published-source
implementation of TFO transform for EFR exists at the present time
(no implementations at all are known outside of TRAU DSP firmware),
hence the general architectural approach of OsmoMGW-E1, flawed
as it is, has to remain for now.  This flawed architecture consists
of passing through unaltered all valid codec frames that are
received in RTP, and inserting fixed dummy TRAU-DL frames when no
RTP-derived ones are available.

The original dummy TRAU-DL frame for EFR exhibited the following
defects:

* D1 bit was set to 0, even though TS 48.060 section 5.5.1.1.2
  states it shall be 1;

* All 5 EFR frame CRCs were invalid: each 3-bit CRC was 000, even
  though the correct TS 48.060 section 5.5.1.1.2 CRC from an
  all-zeros payload would be 111;

* Even if the 5 CRCs were fixed, transmitting an EFR frame of all
  zero bits to the MS won't produce good results - it is a bad
  choice of dummy filler;

* The setting of C-bits (defined in TS 48.060 section 5.5.1.1.1)
  was a mish-mash between TRAU-UL and TRAU-DL frame formats,
  thereby not matching the standard TRAU-DL C-bits fill produced
  by osmo_rtp2trau().

The replacement fill frame introduced here differs as follows:

* The payload bit content is the decoder homing frame (DHF) of
  TS 46.060 section 8.2 Table 7 - the best we can do in the absence
  of a proper TFO transform for EFR;

* The full TRAU-DL frame (C-bits, CRC etc) was generated by passing
  said EFR DHF through osmo_rtp2trau(), using this ad hoc tool:

https://gitea.osmocom.org/themwi/dummy-dl-frames

Change-Id: I5a33a1c9ddf1372f91870d61b5eafac4729ee458
2025-02-05 21:03:29 +00:00
Mychaela N. Falconia
83c8846728 E1 cosmetic: reduce white space in hard-coded TRAU-DL frames
By changing the white space structure of these hard-coded frames
to only have one leading tab on each line of 8 frame bits, we make
it easier to replace these hard-coded frames with different versions
that are programmatically generated, as will be done in the following
patches.

Change-Id: I3d0c931d4dc3d916ba4c5eb081bea22d9c7144de
2025-02-05 20:08:59 +00:00
Pau Espin Pedrol
78ee99adcf mgw: MDCX: Simplify early return code paths
Change-Id: Icb03a95e34e0c7d9396fefc2e37ee33ab09daa89
2025-01-21 16:48:52 +01:00
Pau Espin Pedrol
de4090d920 mgw: Remove wrong TODO comment
The TODO was written because the author had in mind the ptr where the
codec was stored was a MGCP endpoint object, but it is actually an
rtp_end which is an object under conn_rtp, so that's fine already with
current code.

Change-Id: I99d2211e81443883c45cc3fdda10e39a8c152063
2025-01-21 16:48:52 +01:00
Pau Espin Pedrol
732cadd2c8 mgw: Decouple SDP parsing step from conn obj update
This allows delaying modification of the conn before full parsing
succeeds.

Change-Id: I4a2aecb542886672c1f586c6607714e0356abe35
2025-01-21 16:48:52 +01:00
Pau Espin Pedrol
6747b60a95 mgw: DLCX: Split mgcp header pars parsing into a previous step
Do most of the initial parsing and verification in a prior step, filling
in a "parsed" struct which simplifies logic coming after for different
message types.

Change-Id: I557a3a257ddefedc479a4aff974a74c4e4e2c85d
2025-01-21 16:48:52 +01:00
Pau Espin Pedrol
90ae9ed0a2 mgw: MDCX: Split mgcp header pars parsing into a previous step
Do most of the initial parsing and verification in a prior step, filling
in a "parsed" struct which simplifies logic coming after for different
message types.
This commit only modifies stuff enough to work for MDCX.
Further work (commits) will follow for DLCX.

Change-Id: I6ecb41fc2cc737c3a161b6bc98bd08ae01909655
2025-01-21 16:48:52 +01:00
Pau Espin Pedrol
206be49c69 mgw: CRCX: Split mgcp header pars parsing into a previous step
Do most of the initial parsing and verification in a prior step, filling
in a "parsed" struct which simplifies logic coming after for different
message types.
This commit only modifies stuff enough to work for CRCX.
Further work (commits) will follow for MDCX and DLCX.

Change-Id: I3ee5158c254213203830fe9c38de11c15b4b19c1
2025-01-21 16:48:52 +01:00
Pau Espin Pedrol
45559e9230 mgw: Rename and cleanup code allocating rtp/rtcp ports in trunk
Clean up pointers passed. Rename function since it's clearly operating
on trunk related fields through mutexes.

Change-Id: Ib894afcb61609c247883d5ccdd7b8fbf29b2cbf8
2025-01-14 16:44:33 +01:00
Pau Espin Pedrol
f94b846224 mgw: Clean up code allocating conn_rtp rtp/rtcp sockets
Clean up pointers, join 2 functions only making stuff more confusing.
Rename function to make it clear it operates on a conn_rtp object.

Change-Id: I50a251b66e85ceeeccb30dcd1813863d7c754961
2025-01-14 16:44:28 +01:00
Pau Espin Pedrol
3ea3a69821 mgw: Simplify and redo code around ssrc patch feature
The previous logic to configure SSRC patching was over complex and
confusing, with even some broken logic like "patch only once", which is
not really needed. Hence, simplify the internal logic to either patch
SSRC always or don't do it, based on VTY configuration.

The "force SSRC" feature was added in
db2d431697 and further changed in
e2292f3aa1, due to the need for nanoBTS to
always keep the same SSRC on received packets. However, it makes no
sense that is actually needed only once: if remote end changed several
times, then we should keep patching in that case.

This change allows getting rid of confusing applying of settings at a
later time through mgcp_rtp_end_config(), which is no longer needed and
can be dropped, simplifying steps during CRCX/MDCX/DLCX.

Change-Id: Ib7216a775f4ad126e62b9e99aff381fd45015819
2025-01-07 11:47:56 +01:00
Pau Espin Pedrol
46ddc65626 mgw: Move several params setting to mgcp_rtp_end_init()
There's no need to set those 2 params later on, simply set them during
init() to simplify code.

Change-Id: I38e2cfbe03c1e2de48e48f30a04af746bc2368a4
2025-01-07 11:47:56 +01:00
Pau Espin Pedrol
71f313749e mgw: Move force_ptime logic outside of main CRCX func handler
Apply the forced value automatically during init, and then only
override it based on received input from MGCP when it has not been
forced by VTY config.

Change-Id: I02a92a090887caa8e05917a44c8b2351fa7b9b50
2025-01-07 11:47:56 +01:00
Pau Espin Pedrol
80a5abbbe3 mgw: Cleanup rtp_endp fields in its own function
Change-Id: I0b2ccb94129dc7aed6fe13bb20f9910a53d8a41e
2025-01-07 11:47:56 +01:00
Pau Espin Pedrol
ba812f7e86 mgw: Introduce struct mgcp_codecset struct
We do tons of operations on 3 fields (array of codecs, len of array,
selected code) which can be isolated.
Right now, we are using APIs which somehow require structs 2-3 levels of
encapsulation above the ones really required, which makes all code
totally entangled, difficult to understand and prone to errors when
changing stuff in deeply nested structs.
A prove of this is how this patch affects a lot of lines in lots of
places.

Change-Id: Id7db7ab01d56b7fa2415123b604375e48c82ab25
2025-01-07 11:47:56 +01:00
Pau Espin Pedrol
345c37a543 mgw: Introduce mgcp_rtp_end_init()
Change-Id: I29f57dfde60e3134f1db422dc63e7c58d3db7d54
2025-01-07 11:47:56 +01:00
Pau Espin Pedrol
b3457cd250 mgw: Split mgcp_rtp_end to its own file
Preparation path to add an init function and start untangling related
code.

While at it, move definition of struct mgcp_rtp_codec to the mgcp_codec.h where it belongs.

Change-Id: Id1b6cab57e44ad4859bde8212d0ac9f7146d7198
2025-01-07 11:47:56 +01:00
Pau Espin Pedrol
fcf1864db3 Rename mgcp_free_rtp_port() to mgcp_rtp_end_free_port()
While at it, moving the only clearly existing API for the same object to
the same place to have them together
(mgcp_rtp_end_remote_addr_available()).

Change-Id: Ifabd1cf69273a6d22feb65c08de590d083987d09
2025-01-07 11:47:56 +01:00