Commit Graph

6890 Commits

Author SHA1 Message Date
Philipp Maier 9dd80ca1f8 mgcp_codec: refactor payload type converstion
in mgcp_codec.c we have a function mgcp_codec_pt_translate that is used
to find the equivalent payload type number on an opposite connection.
This is quite specific and the resulting payload type number may still
belong to a codec that might require some form of conversion.

Lets refactor this so that the function just finds a convertible codec
for a given connection. This also opens up other usecases. The payload
type conversion like we did it before can then be done with a few lines
in mgcp_network.c

Related: OS#5461
Change-Id: I085260a2ca8cfecdb58656b7a046c536189e238d
2023-03-27 17:50:18 +02:00
Philipp Maier 621e8666ff mgcp_codec: fix oa/bwe comparison in mgcp_codec_pt_translate()
The function mgcp_codec_pt_translate is very strict when comparing the
codecs to each other to find a matching payload type number to be used
on the egress side.

This poses a problem when one side uses AMR in bandwith-efficient, while
the other side uses AMR in octet-aligned payload type format. To the pt
translate function the difference in the payload format will appear as
if the codec were different and eventually the payload type number
cannot be translated.

since osmo-mgw offers conversion between the payload type format it
would be no problem to ignore the payload type format when making the
translation decision. The only exception here would be if one side would
announce AMR two times, the first time with octet-aligned and the second
time with bandwith-efficient format. Then we would have to use the
payload type number from the exact match. (and skip any formatconversion)

To archive such an optimized decision we will first go through the codec
lists and perform an exact match. If we don't get a match we go through
the codec lists a second time, but this time we ignore the payload
format.

Change-Id: Ifbd201a2749009a4644a29bd77e1d0fc0c124a9d
Related: OS#5461
2023-03-27 13:12:50 +02:00
Philipp Maier ec967d74f7 Revert "mgcp_codec: do not differentiate between oa and bwe when comparing codec"
This reverts commit e0058b7207. The reason
for this revert is that the solution in the reverted patch does not
cover a situation where the other side announces both payload formats at
the same time.

It could be that the end facing to a transit network announces both
formats under two different payload types. In this case no conversion
would be necessary. Depending on the input format the output would be
send to the transit network under the payload type that matches and no
conversion would happen at all.

This revert re-intruduces the problem that was fixed in the patch
before. Therefore it must be merged together with the follow up patch
(Ifbd201a2749009a4644a29bd77e1d0fc0c124a9d) that contains the proper fix.

Change-Id: I0b2854ef2397f38606fab3425be586a3d0ca27d1
Related: OS#5461
2023-03-22 17:12:44 +01:00
Philipp Maier 3ccf02a300 mgcp_e1: cosmetic: rewrite comment
Change-Id: I405cf464c052a2ab1461c3a8ba96665a3bc30341
2023-03-22 09:58:34 +00:00
Philipp Maier b6795ddfd2 mgcp_e1: rename e1_send to e1_send_ts_frame
The function name e1_send is very generic, lets make clear that one E1
timeslot frame is sent.

Change-Id: I5fba7993860a63149a13d943edbfabc4008680ef
2023-03-22 09:58:34 +00:00
Pau Espin 747fbce4ce mgcp-client: Call osmo_fd_unregister() before closing and changing bfd->fd
Change-Id: I95fbcc21a18cadd2c06608cc39b9fe8e12c8bccf
2023-03-14 11:48:27 +01:00
Vadim Yanitskiy e1da8c9d2c tests: use -no-install libtool flag to avoid ./lt-* scripts
This option should be used for any executables which are used only
for testing, or for generating other files and are consequently never
installed.  By specifying this option, we are telling Libtool that
the executable it links will only ever be executed from where it is
built in the build tree.  Libtool is usually able to considerably
speed up the link process for such executables.

Change-Id: I4bc03bdc1f2de2574558e2ad753e116486993a7f
2023-03-11 04:47:20 +07:00
Vadim Yanitskiy e78221d273 */Makefile.am: libraries shall not be in AM_LDFLAGS
Change-Id: Ie9df855ee09b0761bd617fab58ca26450ac0c754
2023-03-11 04:46:12 +07:00
Pau Espin 6c303664f5 mgcp_network: Unregister osmo_fd before closing fd
Change-Id: Ib937e56be62327f52d9cf03a07d7620080356ee8
2023-03-09 18:34:12 +01:00
Philipp Maier 544016d8e6 mgcp_e1: rewrite comment
Change-Id: I5e6db4e29ae4af1ec790a4e8b201930206cc5828
2023-02-28 18:45:31 +00:00
Philipp Maier 263a1a3e8f mgcp_e1: fix typo
Change-Id: Ida399e58b996ebab74e719ec907984e5aa9ddce4
2023-02-28 18:45:31 +00:00
Philipp Maier 30bdf94102 mgcp_client: fix sourcecode formatting
Change-Id: I55f98379ea48ffddc25186c15e4dd40762e818b6
2023-02-28 14:32:02 +01:00
Oliver Smith 0dbaaadc06 mgcp_client: mgcp_msg_gen: add more error logs
While adding CSD, this failed for me in add_lco without a descriptive
log message, so add more error messages.

Related: OS#4393
Change-Id: I4873a2db95525aab3e13046b645dd8f90e951466
2023-02-27 08:30:08 +00:00
arehbein 671c37b72b Transition to use of 'telnet_init_default'
Related: OS#5809
Change-Id: Icc57c68337d55c6594c1c36e9bf41624d11dab0a
2023-02-25 17:48:58 +01:00
Philipp Maier 2a9ba66922 mgcp_e1: be more frugal withe E1 line resources
At the moment we open an E1 timeslot when needed, but we never
close it even when it is not needed anymore. This may block other
entities from using it. Lets add some logic to detect whether the E1
timeslot is still needed and make sure that it is closed when it is no
longer needed.

Depends: libosmo-abis.git I073cfaba0d5073447842f22665e213135ea3f635
Change-Id: Ie6a32abbc5cd984f6d72a384e3b47c1b82ce7058
Related: OS#5198
2023-02-22 13:03:54 +01:00
Philipp Maier f8abd0ec0c mgcp_e1: fix log output
Its not the E1 timeslot that is updated, its the E1 line instead
(which includes the timeslot)

Change-Id: Ic72cf90ebdba1b5e395089417c6df5b962f8ffc8
2023-02-13 11:57:52 +01:00
Harald Welte 1a7048d69a cosmetic: Fix grammar suggesting reading _the_ user manual
without the *the*, the sentence sounds Russian - and it wasn't even
added by Vadim or Max :P

Change-Id: I95b66c6cc88f545eb738945233bd2e560abf4711
2023-02-10 11:47:56 +00:00
Philipp Maier c70c08cd49 mgcp_endp: cosmetic: remove unnecessary new line
Change-Id: I5892bc2e07ab16356acb4e75c6f9c31f6604d41e
2023-02-09 13:37:34 +01:00
Philipp Maier a8f13286ff mgcp_endp: cosmetic move mgcp_endp_release to the end
It is more logical to move the function mgcp_endp_release to the end
since it is used to release the endpoint when it is no longer needed for
any transmission. (Also the follow up patch requires the function to be
moved)

Change-Id: Id3166a6a817ddb9ce36ff1b375ff8ed3598a00c2
2023-02-09 13:37:03 +01:00
Philipp Maier b9e7569217 mgcp_sdp: cosmetic: remove newline
Change-Id: Ib9a03a75d9bcc4bdbc9d740edbd12c280ec1d933
2023-02-08 10:21:42 +01:00
Philipp Maier 057decfe3a mgcp_sdp: add spec reference
Change-Id: I16cd453aa986cf9efa0716257230aed8739593da
2023-02-08 09:21:12 +00:00
Pau Espin 342a9a9418 Bump version: 1.10.0.117-22f9c-dirty → 1.11.0
Change-Id: I9f1dcbbf2fdc242e8d304ec6b2a8e1e60d010c32
2023-02-07 16:58:42 +01:00
Harald Welte 22f9cf2687 update outdated vty copyright statement
Change-Id: I7af4bdecddda0b43f98855571942219e8ba00b64
2023-02-06 16:07:07 +00:00
Oliver Smith 26d6b2b5ce mgcp_client: add new clearmode codec
Set 120 as payload type, as specified in 3GPP TS 48.103 table 5.4.2.2.1.

Related: OS#4395
Related: https://www.rfc-editor.org/rfc/rfc4040#section-5
Change-Id: I55f9fe241a405935dbedc3947b0a4f4986acd5cb
2023-01-24 18:18:11 +01:00
Oliver Smith 169d50ed4a Fix various typos
Change-Id: Iba7851a5bdb0ce2ce6852a8fa035b72515d7b0a1
2023-01-24 13:23:21 +01:00
Philipp Maier 82dfb505db mgcp_network: improve coment
the comment that explains the AMR frame format check is a bit difficult
to understand, lets rephrase it.

Change-Id: I07f12c03449e1e8eda8bdd3edad6d1007f5ba48d
2023-01-19 14:28:30 +01:00
Max 9c0d105d09 ctrl: take both address and port from vty config
Change-Id: Id053bc02e0a6359e52a0f5e110128d3bb87ed151
2022-12-20 19:00:45 +03:00
Pau Espin ded02cfc29 iuup: Use osmo_amr_ft_valid() API
This is the only user outside libosmo-abis using this define, which
meaning is not clear at all. Let's simply use the related API to clearly
check the FT.

Related: SYS#6161
Change-Id: I40c7ed2e7f6a99a33b467734e33acf3d5befac0d
2022-12-19 13:24:23 +01:00
Pau Espin 0cbed362cd osmux: Use new osmux_xfrm_input API to set name on each link
Depends: libosmo-netif.git Change-Id 8bb688e4827f345416c2a4526ced956a07fcc60b
Change-Id: Id5b7d497be4b3405403d30e40e1a52f13101cf5f
2022-11-21 10:52:17 +01:00
Pau Espin 310e41cdf3 osmux: Rotate over available Osmux CID when allocating a new one
Before this patch, the free CID with the smallest number was always
selected to be used. This caused more or less the same subset of CIDs to
be used all the time, while the CIDs with bigger numbers were mostly
unused.
Let's distribute the use so that all CIDs are used roughly the same.
This has the advantage, among others, that the same CID will not be
re-used immediatelly after being freed if a new call is established.
It is useful to leave the CIDs unused for some time since the other end
peer may know of the call being tear down with some delay.
Hence if a new call is established immediately after the CID was
released, the same CID would be allocated and passed at the peer, which
would then detect that the old call (in its view still active) would
already make use of that remote CID.

Change-Id: I9dfbcc5e4b4c61ce217020e533d68fbcfa6b9f56
Related: SYS#6161
2022-11-15 18:10:28 +01:00
Max a55bfdc436 Add realtime scheduling and set priority in service file
This sets lowest realtime priority which still takes precedence over any non-realtime service.

Related: OS#5687
Change-Id: Ib1705a164b04b876f129a17c4e8353b9ddcc538e
2022-11-14 10:52:06 +00:00
Harald Welte 6ea8d7dac6 Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition
... if --enable-werror is used

Change-Id: Ib397f3ad748e17f20b6177ef706af65088571f70
2022-11-03 12:53:20 +01:00
Harald Welte 9befdeb673 Support building with -Werror=strict-prototypes / -Werror=old-style-definition
Unfortunately "-std=c99" is not sufficient to make gcc ignore code that
uses constructs of earlier C standards, which were abandoned in C99.

See https://lwn.net/ml/fedora-devel/Y1kvF35WozzGBpc8@redhat.com/ for
some related discussion.

Change-Id: I98a3c0d5cfda2c4b020652efb4f445f8288342b6
2022-11-03 12:53:20 +01:00
Neels Hofmeyr 5fb814b6b9 AMR->IuUP: log conversion, like for the flipside
For IuUP -> AMR, we log a message like
  Convert IuUP -> AMR OA:...
Do the same for the direction AMR -> IuUP.

Related: SYS#5092
Change-Id: I525685a7dedb6d5d1deecbd026844cbe23193fac
2022-10-28 19:04:00 +00:00
Pau Espin 9ac9cb963d Improve logging on AMR OA<->BWE conversion failure
Change-Id: I7c7dd10650c1d249c723d6781585b343004bd64d
2022-10-26 12:36:48 +02:00
Pau Espin 377d39122d osmux: Make sure RTP AMR feed to osmux is in octet-aligned mode
The Osmux implementation in libosmo-netif expects to work with RTP AMR
in octet-aligned mode. Therefore, if the peer connection received RTP
AMR in bandwidth-efficient mode, we need to convert it to octet-aligned
before feeding the packets to the osmux layer.

Related: SYS#6161
Change-Id: Ifeec44241079f7a31da12745c92bfdc4fb222f3a
2022-10-26 11:56:05 +02:00
Pau Espin d1e94c7ac3 osmux: Rename function and pass msgb directly to it
The new prefix now matches other related functions acting on an osmux
connection.
Pass the msgb to it so simplify new msgb copy.

Change-Id: I8c0121485d0c96f70fe8bcbdb150793d428183ff
2022-10-26 11:56:05 +02:00
Pau Espin 6db3f7f1cb mgw: Rename s/mgcp_send_rtp/mgcp_conn_rtp_dispatch_rtp/
The previous name is misleading since the function is not really sending
stuff over a socket, but rather handling/dispatching the incoming
message internally (and finally later it may be sent over a socket under
some conditions).

Change-Id: Idaf791997b8438a4aede50f614afa0d55ad41faa
2022-10-26 11:55:26 +02:00
Pau Espin 58c0b0a6f7 mgw: rx_rtp(): reorder checks and handlings
First validate the origin of the message, then later the content
of the message and finally execute whatever triggers are necessary.
This way contents from unknown senders are not even parsed or acted
upon, avoiding useless potential harm.

Change-Id: I011a6d7d705768c32a35cec5cd7169725a21a670
2022-10-25 18:23:09 +02:00
Pau Espin cca55247ed 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
2022-10-25 18:23:08 +02:00
Pau Espin d266c374ee mgw: Log unexpected RTP AMR OA-vs-BE payload
Change-Id: Ib5ae82c01153398491b21191a8cec9969337bbbc
2022-10-25 18:23:04 +02:00
Pau Espin d358d71206 cosmetic: Clarify and fix typos in comment
Change-Id: Ibcbe7d85cf7e1912de73d59540f2dea1dfa5d98d
2022-10-25 13:09:36 +02:00
Neels Hofmeyr 5e6661eece IuUP->AMR: log whether converting to AMR OA or BE
Enhance the existing log message
  Convert IuUP -> AMR:...
to
  Convert IuUP -> AMR OA:...
(or BE) to show wether emitting Octet-Aligned or Bandwidth-Efficient.

Related: SYS#5092
Change-Id: I3672d01d2879ae8820176a46454f26a4f5f584de
2022-10-24 21:23:15 +02:00
Neels Hofmeyr c1468ef7a5 IuUP->AMR: do not patch payload type a second time
When converting IuUP to AMR/RTP, bridge_iuup_to_rtp_peer() sets the AMR
side's payload type number and then calls mgcp_send(). In mgcp_send(),
do not attempt to patch the payload type number a second time.

In mgcp_send(), skip patching payload type numbers if the source side is
IuUP. This matches exactly the case of converting IuUP to AMR/RTP.

There already is a check for IuUP, but for the wrong side. Drop that one
and explain in a comment why.

Move the comment about transcoding into the failure branch, where it is
relevant and doesn't clutter the new explanation of payload type
patching conditions.

Related: OS#5720
Related: SYS#5092
Change-Id: I7c722cd959f76bd104ae4941d182c77e5c025867
2022-10-24 21:23:15 +02:00
Neels Hofmeyr 24763eaa73 AMR->IuUP: properly translate Q -> FQC
Fix the reversed logic when composing IuUP.FQC:
AMR.Q == 1 means the frame is good.

Without this fix, all frames on IuUP are marked as bad, and no voice is
heard on the IuUP side.

Related: SYS#5092
Change-Id: I29878dd27af9ba0c9e600324c528b22940cdcc30
2022-10-24 21:23:15 +02:00
Neels Hofmeyr d8c2f31a87 AMR->IuUP: do not crash on AMR data before IuUP Init
When translating AMR to IuUP, when AMR data arrives before the IuUP side
has negotiated an IuUP Initialization, do not crash osmo-mgw, but return
failure and drop the AMR packet.

As soon as IuUP Initialization occured and RFCIs are defined, the AMR
starts to pass through to the IuUP side.

Related: SYS#5092
Change-Id: Id9efb7e523d8d9af988e4bf4f5e925839204f934
2022-10-24 21:23:02 +02:00
Pau Espin 01b812ea76 mgcp_send: Use mgcp_conn_rtp_is_iuup() helper
Change-Id: I6988337f395168b88959876fe3827d8e67b8fc00
2022-10-19 19:18:50 +02:00
Pau Espin 0807771b9e Fix misleading error log
The check is not for an AMR RTP packet. It actually only checks for RTP
header.

Change-Id: I60d7dbfeb2977bcb7102eed19e1c73c9433151a7
2022-10-19 19:06:47 +02:00
Pau Espin 103e50a561 mgcp-client: Fix no 'mgw ' prefix written in old VTY node
Recent commit dropped the 'mgw ' prefix in commands under the "mgw" VTY
node because it was redundant.
However, for old apps still not supporting the 'mgw' node, the commands
are still printed in another node and hence the 'mgw ' prefix must still
be appeneded to them, to avoid breaking backward compatibility.

Related: SYS#5987
Fixes: 8c138fe89c
Change-Id: Ifbfb71f8864b425c1b842cdee241ce279d17a8ba
2022-10-19 17:22:48 +02:00
Pau Espin 3a914e33e9 mgcp-client: Refactor system keeping old users not calling mgcp_client_pool_config_write() working
Move the regular writing logic to a subfunction, and raise the flag only
on one of them.
This simplifies the code paths but not marking stuff true and false over
the same code path.

Change-Id: I070798863f2bdc253df004a63262d4bcd529348f
2022-10-19 17:14:51 +02:00