Commit Graph

817 Commits

Author SHA1 Message Date
Andreas Eversberg b865c62d33 ASCI: Fix Null pointer dereference bug in gsm44068_bcc_gcc_trans_free()
Fixes: CID#322142
Change-Id: Iab0b66dfcfdb870eaec4611720ce3a5f2089bd21
2023-07-21 11:16:16 +00:00
Andreas Eversberg 33a433a561 ASCI: Check if codec mapping exists for given codec
Fixes: CID#322143
Change-Id: I65cdf2b7feaa72167c8002cd4d47183f99cab761
2023-07-21 11:16:16 +00:00
Andreas Eversberg d63776051e ASCI: Fix wrong check for Null pointer in vgcs_cell_fsm_null()
Fixes: CID#322145, CID#322141
Change-Id: Iec0820f612450cde772076131b07fe7819d35790
2023-07-21 11:16:16 +00:00
Andreas Eversberg 7e65ed9091 ASCI: Null pointer bug fix in trans_create_bcc_gcc
Fixes: CID#322147
Change-Id: I1676d3cbf844930a6a433253f055a3f8fe3c210b
2023-07-21 11:16:16 +00:00
Andreas Eversberg 23b53e544f ASCI: Receive messages from MSC-A role related to VGCS/VBS
Voice group call and voice broadcast call messages as well as assignment
result are forwarded to VGCS/VBS call control.

Change-Id: Ie68eedb8fcb064a55cd71b58630d7a8c8b5f29ad
Related: OS#4854
2023-07-21 11:16:16 +00:00
Vadim Yanitskiy 57b36e58cb msc_vty: support spaces in short/long network name
Change-Id: If55c92669f06f0d038e8d90088a6bd76133055a2
2023-07-21 11:06:27 +00:00
Andreas Eversberg b265247171 ASCI: Clear VGCS call and channel on BSSMAP reset message
When sending or receiving BSSMAP reset msg, the ongoing VGCS/VBS SCCP
connections are cleared. E.g. this happens if the BSC is restarted and
there is an ongoing VGCS/VBS call at this BSC.

Change-Id: Ib0b309150b82148098d05cfb1fb18767283e654e
Related: OS#4854
2023-07-21 12:28:06 +02:00
Andreas Eversberg 06497197ad ASCI: Add reception of UPLINK RELEASE on dedicated channel
When the calling phone releases the uplink before it has been assigned
to the group channel, it will send an UPLINK RELEASE message on the
dedicated channel.

This message is forwarded to VGCS state machine to handle the release
there.

Change-Id: Ie8f7338da18eaaefbb022c09b96f18a3d78f8a95
Related: OS#4854
2023-07-21 12:28:05 +02:00
Andreas Eversberg f8ac734849 ASCI: Add VTY to configure GCR (Group Call Register)
Change-Id: I5bd034a62fc8b483f550d29103c2f7587198f590
Related: OS#4854
2023-07-21 12:28:03 +02:00
Andreas Eversberg e2a4088619 ASCI: Remove check for trans->msc_a to be set in _assign_complete()
trans->msc_a is always set when ASSIGNMENT COMPLETE is received.

Fixes: CID#322144
Change-Id: I0fe16e59959b48d08d95aefa6d4415f78dcf1eb4
2023-07-19 17:17:21 +02:00
Andreas Eversberg cc72929fad ASCI: Check return code of osmo_mobile_identity_decode()
Fixes: CID#322146
Change-Id: I15a6cf97a901cbb6c99ec2269051a351b504d338
2023-07-19 17:14:54 +02:00
Andreas Eversberg cd8bd45b3b ASCI: Add option to switch on or off ASCI support
Switching ASCI support is controled via VTY. This added in a later
patch. (Chg-Id: I5bd034a62fc8b483f550d29103c2f7587198f590)

Change-Id: Id68deb69f7395f0f8f50b3820e9d51052a34f753
Related: OS#4854
2023-07-19 08:23:23 +00:00
Andreas Eversberg 6c8db1d27c ASCI: Add function to receive VGCS/VBS messages from BSS
A voice group/broadcast call has no SCCP connection that is related 1:1
to a calling or called subscriber. Instead there are multiple connections
between MSC and BSS. Some of them control the uplink for each BSS and
some of them assign the channels for each BTS.

SCCP connections are maintained by the VGCS call control. Message from the
RAN are directly forwarded to the VGCS call control.

Change-Id: Ie4a2f19ba75140a6f2de02b709597239c01f02a2
Related: OS#4854
2023-07-19 08:23:23 +00:00
Oliver Smith 80654ed67d csd_bs_to_gsm0808: add T 300 / proper ch_rate_type
There is no GSM0808_DATA_RATE_TRANSP_300 (not in libosmocore and not in
3GPP TS 48.008 § 3.2.11 on which the enum is based). As I understand it,
we need to use GSM0808_DATA_RATE_TRANSP_600.

As pointed out in review, either TCH/H2.4 or TCH/F2.4 would work for
rates below 9600, so use GSM0808_DATA_FULL_PREF.

Use GSM0808_DATA_FULL_BM instead of GSM0808_SPEECH_FULL_BM. The value is
0x8 for both, but this is the correct name.

Related: OS#4394
Change-Id: I7297cc481fbe36355b5231ca800cf566a1ee93c0
2023-07-18 11:14:48 +02:00
Andreas Eversberg f7c6f1424f ASCI: Add decoder for VGCS/VBS messages to msc_a.c
VGCS/VBS messages from BSS are decoded and a receiver funktion for
the GCC/BCC (VGCS/VBS call control) is selected.

Change-Id: Ief6259ba3914eeaceb063b562a0bcbc48349ce60
Related: OS#4854
2023-07-17 12:29:42 +00:00
Andreas Eversberg e24636c6bb ASCI: Add call control for VGCS/VBS
Change-Id: I9947403fde8212b66758104443c60aaacc8b1e7b
Related: OS#4854
2023-07-17 12:29:42 +00:00
Andreas Eversberg 9bbdc34a65 ASCI: Add callref to assignment command
The (optional) call reference is required to assign a calling subscriber
to a voice group/bcast channel. The BSC can then determine to which
existing VGCS/VBS channel the MS is assigned to.

This IE is part of the GSM standard TS 48.008 (see §3.2.1.1)

Change-Id: I7955c6e0eebc930f85f360dda46be17cbd39e181
Related: OS#4854
2023-07-17 12:29:42 +00:00
Andreas Eversberg 2d27e2ccb1 ASCI: Add functions to transcode VGCS/VBS messages on A-interface
Change-Id: I6b1f088201e7ef4a58762937855a1d358973882c
Related: OS#4854
2023-07-17 12:29:42 +00:00
Andreas Eversberg cd605f30b7 ASCI: Add simple implementation of Group Call Register
This is a built-in data structure to store and handle voice group calls.

The GCR will be used by VGCS/VBS call control.
 (Chg-Id: I9947403fde8212b66758104443c60aaacc8b1e7b)

The GCR will be used by VTY code.
 (Chg-Id: I5bd034a62fc8b483f550d29103c2f7587198f590)

Change-Id: Ia74a4a865f943c5fb388cd28f9406005c92e663e
Related: OS#4854
2023-07-17 12:29:42 +00:00
Oliver Smith 429ab7bb97 mncc_builtin: permit data bearer types
Related: OS#4394
Change-Id: I7bd6fa836e5a5c05c5d2358a9b8fd2b61981dd5f
2023-07-12 09:54:57 +00:00
Oliver Smith fa006b8a36 csd_bs_list_remove: fix removal logic
Related: OS#4394
Change-Id: I638d4e063fee6bad45ab14d8ad6b9ad847a7127a
2023-07-10 07:03:29 +00:00
Andreas Eversberg 5b1ab541a2 ASCI: Allow transaction without subscriber associated
Generally a transaction is linked with a subscriber (vsub).

A voice group call transaction may not have a subscriber associated. The
vsub field of the transaction will be NULL. If the group call is
initiated by a calling subscriber, the vsub field is set until the
calling subscriber is assigned to the voice group channel. If the group
call is initiated via VTY, vsub field is not set on creation of the
transaction.

Change-Id: I2b9afe95db4c106c141f4b7bd199ec74e197e523
Related: OS#4854
2023-07-09 07:41:33 +00:00
Andreas Eversberg 456c6f7e4d ASCI: Add two new transaction types for VGCS and VBS
- TRANS_GCC is used for the voice group call.
- TRANS_BCC for the voice broadcast call.

This also includes the use counters for transaction and CM service
request usage:
- MSC_A_USE_GCC
- MSC_A_USE_BCC
- MSC_A_USE_CM_SERVICE_BCC
- MSC_A_USE_CM_SERVICE_GCC

Change-Id: Iddd11f813582ac2ac2bdee91cc3a525986deb514
Related: OS#4854
2023-07-09 07:41:33 +00:00
Andreas Eversberg 7e4b032b88 ASCI: Add transaction type to trans_find_by_callref()
A transaction can be identified by the callref and the type. Because
transactions with different types may share the same callref value,
it is required to include the type in the trans_find_by_callref()
parameters.

E.g. a voice group call may have the same callref as a voice broadcast
call, but they are different calls. They also may not be confused with
other transaction types having eventually equal callref value, like
GSM 04.08 calls, SMS or supplementary services transactions.

By adding the transaction type to trans_find_by_callref(), we
essentially now use the (type, callref) tuple as unique ID for
transactions, instead of just callref.

Change-Id: Ic0b82033a1aa3c3508ad610c690a5f29073006c1
Related: OS#4854, OS#3294
2023-07-09 07:41:33 +00:00
Andreas Eversberg bcb4d6b26f ASCI: Allow usage of rtp_stream with other FSM
Allow the caller of rtp_stream_alloc() to define what events will be
dispatched to the parent FSM. This allows other state machines to use
rtp_stream. It is required for using RTP stream process with VGCS FSM.

Drop the unused parent_call_leg member.

Change-Id: I0991927b6d00da08dfd455980645e68281a73a9e
Related: OS#4854
2023-07-09 07:41:33 +00:00
Andreas Eversberg 58fe2e03c8 ASCI: rtp_stream_commit(): Also update MGW on conn mode change
So far rtp_stream_commit() triggers an MGCP MDCX message only when
codecs or the RTP address changed.
Do the same for mode changes. ('sendrecv', 'recvonly', 'sendonly',...)

Change-Id: I7a5637d0a7f1df13133e522fc78ba75eeeb2873e
Related: OS#4854
2023-07-09 07:41:33 +00:00
Andreas Eversberg 712b28e695 ASCI: Use a unique call-id for RTP streams
The MGCP protocol features the 'C' (call-id) to identify which
connections belong to the same call. They may be used by MGW for
accounting or management procedures.

So far we sent the MNCC callref as call-id. Instead, add a separate
unique call_id number space. Assign a unique call_id to each
transaction.

Change-Id: I36c5f159fa0b54fb576ff8bd279928b895554793
Related: OS#4854
2023-07-09 07:41:33 +00:00
Oliver Smith 412cf92d3c gsm48_cc_tx_setup: use MNCC bcaps for CSD
Use the MNCC bearer capabilities in CC setup for CSD, if available.

Note that in the MNCC_F_BEARER_CAP code path sdp_audio_codecs_set_csd()
also gets called by trans_cc_set_remote_from_bc().

Related: OS#4394
Change-Id: I56e49ebc41696912a81b8f4f63fbc36d0b605e9e
2023-07-06 14:52:06 +02:00
Oliver Smith 8e16e8b338 gsm48_cc_tx_alerting: check rc of sdp_msg_from_sdp_str
Fixes: CID#321280
Change-Id: Id372d2d844446d6667a00dae22bdf8ed36c599ba
2023-06-23 10:55:55 +00:00
Oliver Smith 17399803a4 csd_bs_list_to_gsm0808_channel_type: fix rc check
Check the return code before writing it to unsigned ct->data_rate, as
"ct->data_rate < 0" is never true.

Fixes: CID#321277
Fixes: 106321 ("Add initial CSD support with external MNCC")
Change-Id: I5d77da71b60748818ba631229126c1bf061a9c7d
2023-06-23 10:38:46 +00:00
Oliver Smith 0d4607d90d msc_ho_send_handover_request: fix check_after_deref
Fixes: CID#211073
Change-Id: I9389cc9c4af987c11652c6fe9a0ff4289a7781c9
2023-06-22 14:53:17 +02:00
Oliver Smith 1063213b38 Add initial CSD support with external MNCC
Implement and use CSD bearer service logic (with similar audio codec code):
* csd_filter (codec_filter)
* csd_bs (sdp_audio_codec)
* csd_bs_list (sdp_audio_codecs)

Related: OS#4394
Change-Id: Ide8b8321e0401dcbe35da2ec9cee0abca821d99a
2023-06-20 12:47:05 +02:00
Oliver Smith 64f3930c72 gsm48_cc_tx_setup: set trans->bearer_cap.transfer early
Prepare to use trans->bearer_cap.transfer in trans_cc_filter_run() to
differentiate between speech and data (CSD).

Related: OS#4394
Change-Id: Id0476a4882bcb27413d033f2de2c5288954f0b95
2023-06-15 15:06:46 +02:00
Oliver Smith 8a8ce714ff msc: add trans_cc_set_remote_from_bc
Prepare to set remote CSD bearer services in a future patch.

Related: OS#4394
Change-Id: I71a8ff6167e2adf3ee609883730e5f67b7539185
2023-06-15 15:06:46 +02:00
Oliver Smith c63c3a0cc5 transaction: move cc.codecs.result -> cc.local
Prepare for CSD where this will be used too.

Related: OS#4394
Change-Id: Iaf954be0455625faa06a64c19905b79b7045f8e4
2023-06-15 15:06:46 +02:00
Oliver Smith 593cd88535 transaction: move cc.codecs.remote -> cc.remote
Move remote out of codecs, as it will be used by CSD code as well.
Otherwise we would need to store it twice (in cc.codecs.remote and
cc.csd.remote).

Related: OS#4394
Change-Id: I5d2e078db3b3437cb6feae40d8955912d7a297e4
2023-06-15 15:06:46 +02:00
Oliver Smith ceca8e6d2d codec_filter_run: prepare for CSD
Related: OS#4394
Change-Id: I18b396193ad25a3905cc8c1853c9680dab0a2d44
2023-06-15 15:06:46 +02:00
Oliver Smith 1c7f1787bd codec_filter_set_bss: prepare for CSD
Related: OS#4394
Change-Id: I931db33820d9da81147bda84002ada0b80f11186
2023-06-15 15:06:46 +02:00
Oliver Smith c7c40c9648 codec_filter_set_ran: prepare for CSD
Related: OS#4394
Change-Id: I467a7bd461dcac2fff93a3777d4090d6b7d3d041
2023-06-15 15:06:46 +02:00
Oliver Smith a35abb761c codec_filter_init: prepare for CSD
Related: OS#4394
Change-Id: I1270b00464456abc5300fd47e6087a0ba6243d03
2023-06-15 15:06:46 +02:00
Oliver Smith 0b70b20a89 Cosmetic: gsm48_cc_tx_setup: remove TODO comment
Remove the comment as trans->bearer_cap will be used in CSD code to
differentiate between speech and data.

Related: OS#4394
Change-Id: I0539632f464bc44945599bec52dc2a4df2f0115f
2023-06-15 15:03:55 +02:00
Oliver Smith e545b9d3d6 Cosmetic: gsm48_cc_tx_setup: tweak comment
Remove the misleading "We must not pass bearer_cap to
codec_filter_init()" part of the comment. The function doesn't accept a
bearer_cap parameter, it cannot be passed to the function:

  void codec_filter_init(struct codec_filter *codec_filter)
  {
  	*codec_filter = (struct codec_filter){};
  }

Related: OS#4394
Change-Id: I87a1e371e108d8da514b30f1726aad0f85ea4111
2023-06-15 14:25:24 +02:00
Oliver Smith 5375f78ebb codec_filter_set_ms_from_bc: prepare for CSD
In all the places where codec_filter_ functions get called, for CSD we
will need to filter the bearer services. Add a new
transaction_cc.c file for functions that either combine the
codec_filter_ function with logic for CSD and voice calls or just call
the existing codec_filter function and a new csd_filter function.

Start with moving codec_filter_set_ms_from_bc to this new file, it will
be extended with a case for CSD in a future patch.

Related: OS#4394
Change-Id: If225f2a299ce6bc9ae35a17d6f591d889f49155e
2023-06-15 14:25:24 +02:00
Oliver Smith b1a1588f6e ran_a_channel_type_to_speech_codec_list: add CSD
Related: OS#4394
Change-Id: I336e6aa735f894aa35b2ccfe24a54eb171d7ad10
2023-06-15 10:29:29 +02:00
Oliver Smith b4b9ec805a codec_mapping: add clearmode
Related: OS#4394
Change-Id: Ieeaca6a00dc332424d443e44251f3219245511db
2023-06-15 10:29:29 +02:00
Pau Espin 9e3bab9e97 Use new mgcp_client_conf_alloc() API to alloc mgcp_client_conf
Depends: osmo-mgw.git Change-Id Iba0853ed099a32cf1dde78c17e1b34343db41cfc
Change-Id: I382046bba67646a7365d9290d604b97c9d886e02
2023-06-14 14:09:11 +02:00
Vadim Yanitskiy 999a593efb copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
Change-Id: I81687235fedcbbb686db7def59318e891e00ced7
2023-05-18 17:22:26 +07:00
Neels Hofmeyr 388d7c9374 3G: decapsulate IuUP to AMR at the MGW; allow 3G<-AMR->2G
For all 3G calls, convert IuUP <-> plain AMR/RTP on the MSC's MGW hop
like this:

Before this patch:

 hNodeB <--IuUP--> MGW@hnbgw <--IuUP--> MGW@msc <--IuUP--> other call leg

After this patch:

 hNodeB <--IuUP--> MGW@hnbgw <--IuUP--> MGW@msc <--AMR--> other call leg
                                                    ^

This allows, in principle, 2G to 3G calls without expensive transcoding,
like this:

 hNodeB <--IuUP--> MGW@hnbgw <--IuUP--> MGW@msc <--AMR--> MGW@msc <--AMR--> MGW@bsc <--AMR--> 2G-BTS
                                                    ^
(So far only proven to work with AMR-FR at 12k2.)

3G to 3G calls now look like this:

 hNodeB <--IuUP--> MGW@hnbgw <--IuUP--> MGW@MSC <--AMR--> MGW@MSC <--IuUP--> MGW@hnbgw <--IuUP--> hNodeB
                                                    ^

Implementatino: get rid of the shim that was put in place to still send
IuUP (VND.3GPP.IUFP) to the CN. So now, for all 3G voice, the IuUP gets
decapsulated to plain AMR/RTP at the MSC's MGW hop.

What is proven to work with this patch:
successful voice call between 2G and 3G with these conditions:
- a hNodeB that stubbornly accepts only 12k2 AMR;
- a 2G BTS configured to use only TCH/F and only FR3, with only 12k2 as
  allowed AMR rate.

We have not yet seen a call working for TCH/H HR3 <-> 3G, because of the
lab hNodeB's limitation to 12k2.

Future work we probably need:
- properly request and negotiate AMR rates via SDP fmtp:mode-set.
- request more RFCIs in our RANAP RAB Assignment requests
  (see I61e0e9e75e3239662846fd797532acdefa9f73dc).
- Convert IuUP to AMR already at the HNBGW's MGW?
Solving this is not part of this patch.

Related: SYS#5092
Change-Id: I386a6a426c318040b019ab5541689c67e94672a1
2023-04-05 13:47:46 +00:00
Neels Hofmeyr b091d2138d HO Req: include IE Codec List (MSC Preferred)
This will make the 10 inter-MSC HO tests in MSC_Tests.ttcn pass again.

Related: OS#5529
Change-Id: Ifcf719c5fc9e11749aafbd97bafda7f6f50973ea
2023-03-18 03:05:34 +01:00
Neels Hofmeyr b6c11c43bb codecs: compose HO Req Ch Type from cc.codecs
Change-Id: Iba7a1a87ec5e6b487f763e84d60ed285da7b8fe1
2023-03-18 03:05:34 +01:00
Neels Hofmeyr 1c0650767a mncc_recvmsg(): log caller file,line
Change-Id: I3755eb35b504f2f2580e0ba43dfa41f16087decc
2023-03-18 03:05:34 +01:00
Neels Hofmeyr bd5f8e900b do CN CRCX first
In order to send the MSC's RTP endpoint IP address+port in the initial
SDP, move the MGCP CRCX up to an earlier point in the sequence of
establishing a voice call.

Update the voice call sequence chart to show the effects.

Though the semantic change is rather simple, the patch is rather huge --
things have to happen in a different order, and async waits have to
happen at different times.

The new codec filter helps to carry codec resolution information across
the newly arranged code paths.

Related: SYS#5066
Change-Id: Ie433db1ba0c46d4b97538a969233c155cefac21c
2023-03-18 03:05:34 +01:00
Neels Hofmeyr 11a746acd3 [codecs filter] use codecs filter on crcx ok
Change-Id: I03753df567d1dc24852e6fbb681fbba81d2a545d
2023-03-18 03:05:34 +01:00
Neels Hofmeyr 8dd1646f0b [codecs filter] send + receive SDP via MNCC
Transmit and receive full SDP information via MNCC, to accurately pass
codecs choices between the call legs.

In msc_vlr_test_call.c test_call_mt(), show that when receiving MNCC,
the codec information in SDP overrules the Bearer Cap codec information
-- we expect to still receive inaccurate Bearer Cap from e.g.
osmo-sip-connector, because we have chosen to add SDP to MNCC instead of
trying to fix the codecs represented in Bearer Cap.

For internal MNCC, the MT call leg now knows which codec the MO has
chosen and assigned.

For external MNCC, osmo-sip-connector receives SDP about our codecs
choices and sends it in SIP messages, and we also receive the full SDP
information from the remote SIP leg.

Update the SDP in codec_filter every time it is received, to always have
the latest SDP information from the remote leg.

 CC              MNCC
 | ---ALERTING--> |     add local side SDP to MNCC msg
 | <--ALERTING--- |     store remote side SDP
 | <--SETUP-RESP- |     store remote side SDP
 | --SETUP-CNF--> |     add local side SDP to MNCC msg
 | -RTP-CREATE--> |     use codec_filter, add local side SDP to MNCC msg
 | <-RTP-CONNECT- |     store remote side SDP

There still is one problem: when initiating MNCC, we do not yet know the
RTP address and port to be used for the CN side, because the CN CRCX
happens later. So far we send 0.0.0.0:0 as RTP endpoint in the SDP,
until the CN CRCX is done. A subsequent patch moves CN CRCX to an
earlier time, adding proper RTP information right from the start.

Related: SYS#5066
Change-Id: Ie0668c0e079ec69da1532b52d00621efe114fc2c
2023-03-18 03:05:34 +01:00
Neels Hofmeyr 006b0ee50a [codecs filter] use filter result in Assignment
So far, patches have set up rtp_stream to allow setting multiple codecs,
and collected the codecs information into the codecs filter struct.
Now actually use the codecs filter result to choose a codec.

Setting up the call leg FSMs and codecs still looks rather confusing in
this patch, because this is an incremental step in a larger series. The
upcoming patch 'do CN CRCX first' clarifies this substantially.

The resulting codecs behavior is tested in upcoming patch
I879ec61f523ad4ffc69a0b02810591f7c0261ff9. (The test ideally should have
come before this patch, but my time to rework this branch is up.)

With the codecs filter in place, we are ready for sending and receiving
full SDP via MNCC, see upcoming Ie0668c0e079ec69da1532b52d00621efe114fc2c
and Ie433db1ba0c46d4b97538a969233c155cefac21c

Related: SYS#5066
Change-Id: I66e7c8c5e401f4f3a7d3d42b9525b2c6e99691d9
2023-03-18 03:05:34 +01:00
Neels Hofmeyr 909ea5218c [codecs filter] use filter result in MT DTAP CC Setup
So far, we just forwarded the Bearer Capabilities received in MNCC from
the remote MO call leg, and omitted Bearer Cap if the remote call leg
did not provide any.

Instead, always include Bearer Cap, and compose it from the codecs
filter result. Hence the Bearer Cap is now an intersection of MS, BSS
and remote call leg, instead of just the remote call leg.

Related: SYS#5066
Change-Id: I9586221ef56352b7ce4b2604ae0dc04554145a78
2023-03-18 03:05:34 +01:00
Neels Hofmeyr 7934e0d974 in ran_msg, return gsm0808_speech_codec (inter-MSC)
Get rid of enum mgcp_codecs in inter-MSC handover related code.

Change-Id: I9c649f98738a55b8637ae600d5cdf81099fd08e5
2023-03-18 03:05:34 +01:00
Neels Hofmeyr cec51b340e in ran_msg, return gsm0808_speech_codec (intra-MSC)
Do not convert to enum mgcp_codecs, but directly pass the
gsm0808_speech_codec IE from the A interface to codecs handling.

For Iu:
- RAN side: use ran_infra.force_mgw_codecs_to_ran to keep the MGW
  endpoint towards RAN on IUFP.
- CN side: introduce flag ran_msg.assignment_complete.codec_with_iuup,
  so to decide whether to forward IUFP towards CN, we don't need to test
  the RAN type, but use the flag from the ran_msg implementation.

In msc_vlr_tests, use the SDP codec string instead of enum
mgcp_codecs.

So far limit to intra-MSC related messaging, adjusting inter-MSC
handover follows in a separate patch.

Change-Id: Ia666cb697fbd140d7239089628faed93860ce671
2023-03-18 03:05:34 +01:00
Neels Hofmeyr 62bfa37eae rtp_stream: allow multiple codecs / use codec filter from Assignment
Allow configuring MGW conns with multiple codecs. The new codecs filter
can have multiple results, and MGCP can configure multiple codecs. Get
rid of this bottleneck, that so far limits to a single codec to MGW.

On Assignment Complete, set codec_filter.assignment to the assigned
codec, and use that to set the resulting codec (possibly multiple codecs
in the future) to create the CN side MGW endpoint.

Related: SYS#5066
Change-Id: If9c67b298b30f893ec661f84c9fc622ad01b5ee5
2023-03-18 03:05:34 +01:00
Neels Hofmeyr 1dc3961a0a add ran_infra.force_mgw_codecs_to_ran
Indicate in the ran_infra data structure whether a RAN needs specific
codecs to be set up on the RAN facing MGW endpoint.

This allows setting forced RAN codecs as first-class citizen in the
ran_infra data structure, instead of special cases in the code (for IuUP
on IuCS).

Will be used in subsequent commit
I37f65c36af2679ecba1040a11a9aa0eb9481d817, submitted separately for
easier readability.

Change-Id: I37f65c36af2679ecba1040a11a9aa0eb9481d817
2023-03-18 03:05:34 +01:00
Pau Espin c0f9474045 rtp_stream: Fix remote_osmux_cid_sent_to_mgw never set to true
Change-Id: I978c78976470a6c5a36da8611a203f96c9a1b2a5
2023-03-15 13:01:04 +01:00
Pau Espin a202cf43c7 rtp_stream: Update id after modifying fields upon Tx of MGCP msg
Change-Id: Ifbcab2d07df96d2a826e8235306b18df9573802c
2023-03-15 12:53:43 +01:00
Neels Hofmeyr 2d57d6eaa9 [codecs filter] apply BSS codecs from Assignment Complete
Codec List (BSS Supported) is received once in Complete Layer 3 and
again in Assignment Complete messages. Use the most recent one, i.e. the
one from Assignment Complete, when it occurs.

Related: SYS#5066
Change-Id: I5e66ecc7987fa926f39d8be8eaf5799b931ab20a
2023-03-14 22:41:52 +00:00
Neels Hofmeyr 10357f801b [codecs filter] MT call: store MS Bearer Cap from CC Call Conf
Related: SYS#5066
Change-Id: Ic3d0f05af57a493d500700c63b121c8114e7fbf4
2023-03-14 22:41:52 +00:00
Neels Hofmeyr af9d30eff5 [codecs filter] MT call: apply remote call leg codecs
Collect either the SDP or the Bearer Capabilites in the incoming
MNCC in the new codecs filter.

So far just collect the info and do not change the behavior, using the
filter result will follow in a subsequent patch.

Related: SYS#5066
Change-Id: I84d9bbca3e4061da622b1b2fc0bde8868e7e3521
2023-03-14 22:41:52 +00:00
Neels Hofmeyr 7ddc48c197 [codecs filter] MT call: apply BSS codec list
For MT call, initialize the codecs filter and apply the
Codec List (BSS Supported) from Compl L3.

Related: SYS#5066
Change-Id: I530409a64d11da48518a3dc60aa3a4e47c384663
2023-03-14 22:41:52 +00:00
Neels Hofmeyr f55595270f [codecs filter] MO call: apply BSS codec list
Related: SYS#5066
Change-Id: I062268406ae3f3a63a7f413db51c509c9eaf9e8a
2023-03-14 22:41:52 +00:00
Neels Hofmeyr e276ae9bc7 [codecs filter] store BSS codec list from Compl L3
The initial Compl L3 happens long before we establish a CC transaction.
Remember the Codec List (BSS Supported), so that we can feed the new
codecs filter with it. Subsequent patches implement feeding the filter.

Related: SYS#5066
Change-Id: I7cdc348218433141a43d2e42750af02591688240
2023-03-14 22:41:52 +00:00
Neels Hofmeyr 63881a3735 [codecs filter] add codec_filter.h,c
Add the infrastructure to store and filter all codec limitiations from
the different stages: MS, BSS, CN and remote call leg. Upcoming patches
will properly collect these and find an optimal codec.

No functional change, yet.

Related: SYS#5066
Change-Id: I4d90f7ca62f2307a7b93dd164aeecbf4bd98ff0a
2023-03-14 22:41:52 +00:00
Neels Hofmeyr a001a70048 MNCC: use codec_mapping, drop mgcp_codec_to_mncc_payload_msg_type()
Change-Id: I8995ef43b9f79bc1db5672362c6433e4d96dd9e0
2023-03-14 22:41:52 +00:00
Neels Hofmeyr b2ce74829a add codec_mapping.h,c
Converting between different codec representations is confusing. This
codec mapping provides a consolidated overview of all our codec
representations, and how they match up.

In particular, it adds the SDP codec representation repertoire,
preparing the use of full SDP on the MNCC interface.

Related: SYS#5066
Change-Id: Iaa307be6a8487aa8d4ba7cd59d5c5ef04818a744
2023-03-14 22:41:52 +00:00
Pau Espin c43b01e918 mncc_sock: Call osmo_fd_unregister() before closing and changing bfd->fd
Change-Id: I90f840da4cc26c1d970c3f5d18d3185678a1dba9
2023-03-14 11:44:40 +01:00
Neels Hofmeyr 58f408839c tweak MNCC logging, add RTP info
Omit "in state FOO", because LOG_TRANS() already logs the state.

Most MNCC "rx" logging was duplicated. Log "rx" only once.

If there is RTP information passed with the MNCC message, log it:
- if there is SDP, log the SDP information.
- if there is no SDP, log the legacy MNCC RTP fields, if any.

One motivation to do this is to get RTP information in ladder diagrams
generated by msc_log_to_ladder.py without the need to add udtrace MNCC
logging to osmo-msc; and also to get RTP info for internal MNCC, where
udtrace doesn't apply, because no unix domain socket is involved in
internal MNCC operation.

Change-Id: I4b916cb482ed441b508c6295de211a21c49cd5c1
2023-03-09 01:49:14 +01:00
Neels Hofmeyr a818153967 IuCS: remove IuUP LOOPBACK hack
Since osmo-mgw now supports IuUP properly, and since we indicate IUFP in
the MGCP CRCX towars an IuCS RAN [1], we should no longer place the MGW
endpoint in loopback mode to hack up an IuUP Initialization.

This hack should have been removed along with [1].

[1] IUFP sent to MGW since this commit:
commit 3a02d29804
Refs: 1.8.0-13-g3a02d2980
Announce IuFP audio codec for UTRAN conns in CRCX towards MGW
I7aca671e00ed27ac03f0d106b5a6b665a9bed4c1

Change-Id: I6446c64421e3e13e2b829293d031c98b99cd39a7
2023-03-04 03:58:30 +01:00
Neels Hofmeyr ede9083946 comment: clarify L3 Info processing
Related: SYS#5066
Change-Id: Ia9180eeb88b31a2cf7dea72b43affd0c7b239ccb
2023-03-04 03:58:30 +01:00
Neels Hofmeyr 8ff00e775c sdp_msg.c: fix missing rate in sdp_audio_codecs_add()
When a new entry is is added by sdp_audio_codecs_add(), also add the
proper rate.

Change-Id: I17ad8862f662975e2df72a332eb83df7fb048cad
2023-03-04 03:57:02 +01:00
Keith Whyte 404fb1b60e LCLS: Fix Global Call Reference generation
According to 3gpp spec the Call Reference part of GCR is 5 octets,
3 octets Call ID followed by 2 octets BSS ID.

We are using our internal call reference (4 octets) and the
location area code, or optionally Cell ID as BSS ID
(2 octets). Obviously it does not fit.

Let's use only 3 octets from the call reference, dropping the MSB.

Includes code by Vadim Yanitskiy <vyanitskiy@sysmocom.de>

Change-Id: I9c33a89c819e8925d89ca833d7705ed5ced6b566
2023-02-01 03:08:37 +01:00
Neels Hofmeyr 91c9c2f7aa rtp_stream: set_remote_addr: do nothing when unchanged
Change-Id: I15181d84f3eb8a4ab9077cf12fcb138d51733102
2023-01-03 00:31:38 +01:00
Neels Hofmeyr a899dea9aa rtp_stream_commit: check missing MGW ep only when ready for RTP
Change-Id: I24a81a926b97c9f0fb31df782d1cf931eaff9db1
2023-01-03 00:31:38 +01:00
Neels Hofmeyr 5b1f9a2d0c fix sdp_msg_to_sdp_str(), never add fmtp for unset codec
Change-Id: I1892efd9360585f98419ebbd0df180f7f3a8160d
2023-01-03 00:31:38 +01:00
Neels Hofmeyr 01431080a3 sdp_msg.c: parse send/recv mode
Related: SYS#5066
Change-Id: I529c0bfad1cab376e26173ed48db2767c7dfaa64
2022-12-23 14:54:26 +00:00
Vadim Yanitskiy 8284fb053d libmsc: check return value of gsm0808_create_ass2()
Change-Id: I6fd1669f2919034599d99336cf56f25a97afdf7c
2022-12-14 04:47:58 +07:00
Neels Hofmeyr 40d3497877 add some comments to sdp_msg.c,h
Related: SYS#5066
Change-Id: I68aa4af5d84eaaa08a567377687b6292cce0ce94
2022-11-15 12:53:07 +00:00
Neels Hofmeyr 2d116822f3 add sdp_audio_codec_is_set
Change-Id: I078efe5b42367ad1089c53f11f7eb6f3a9dd9443
2022-11-15 12:53:07 +00:00
Neels Hofmeyr e29ee5a4e2 log CC timeouts
Change-Id: I857b4b15ebf75cf253697e96d358128620923221
2022-11-15 12:53:07 +00:00
Neels Hofmeyr 6d9b485f6a sdp_msg: when NULL, do not crash but return empty SDP str
Change-Id: Ibd5c43fae61cd006d8fb42a06b99a609356f7037
2022-11-15 12:53:07 +00:00
Neels Hofmeyr 2ea7264b86 msc_a,vlr: add is_ciphering_required (accurately named)
For establishing Layer 3, pass a flag from msc_a to VLR that indicates
to fail if encryption is not possible.

An earlier patch [1] renamed a previously existing flag
require_ciphering to is_ciphering_to_be_attempted, because the naming
was not accurate. This new flag now indicates what its name suggests.

This new flag is needed for upcoming patch [2] to distinguish between
optional and mandatory encryption.

[1] Ia55085e3b36feb275bcf92fc91a4be7d1c24a6b9
[2] I5feda196fa481dd8a46b0e4721c64b7c6600f0d1

Related: OS#4830
Change-Id: I52090c5f5db997030da7c2ed9beca9c51f55f4cf
2022-10-27 23:54:00 +02:00
Neels Hofmeyr d99a607ac9 msc_a,vlr: rename ciphering_required to is_ciphering_to_be_attempted
Clarify the name to avoid confusion in upcoming patches.

This function actually returns whether any ciphering mode besides A5/0
is enabled, and does not imply that ciphering is mandatory. A5/0 may
well be allowed when this function returns true.

Related: OS#4830
Change-Id: Ia55085e3b36feb275bcf92fc91a4be7d1c24a6b9
2022-10-27 23:30:30 +02:00
Pau Espin 093fd2e2b7 call_leg: Fix EV_MGW_ENDPOINT_GONE not processed in RELEASE state
Since call_leg_fsm_releasing_onenter() calls immediatelly
osmo_fsm_inst_term(), it meant we couldn't receive any event in that
state because osmo_fsm disables event dispatching to FSMs being
terminated.
As a result, CALL_LEG_EV_MGW_ENDPOINT_GONE was never received and hence
call_leg_mgw_endpoint_gone() was never called, which means the
mgcp_client used in cl->mgw_endpoint was never put back to the pool.

By first freeing all the children (rtp_streams), we make sure
cl->mgw_endpoint ends up with no conns and sends us the GONE event
before we go ourselves into termination state.

Related: SYS#5987
Change-Id: I2126578c4e64c9f336e8a1f6ee98de970866b8dc
2022-10-19 18:46:05 +02:00
Pau Espin 53639ea03f vty: Make use of new mgcp_client_pool_config_write() API
Let's use the new API available in libosmo-mgcp-client to control more
consciously where the mgw pool config is printed.
Before this patch, the place where the node was printed was defined
based on implementation details on how the enum of nodes are defined and
installed.

Related: SYS#5987
Depends: osmo-mgw.git Change-Id I7a620cf47886d8ecab30ce369cf123d98ab842c5
Change-Id: Ic473fe05c55e8df3eddedf0260ec04b6fefc501f
2022-10-19 18:27:18 +02:00
Pau Espin b44cf2d575 Introduce support for libosmo-mgcp-client MGW pooling
Large RAN installations may benefit from distributing the RTP voice
stream load over multiple media gateways.

libosmo-mgcp-client supports MGW pooling since version 1.8.0 (more than
one year ago). OsmoBSC has already been making use of it since then (see
osmo-bsc.git 8d22e6870637ed6d392a8a77aeaebc51b23a8a50); lets use this
feature in osmo-msc too.

This commit is also part of a series of patches cleaning up
libosmo-mgcp-client and slowly getting rid of the old non-mgw-pooled VTY
configuration, in order to keep only 1 way to configure
libosmo-mgcp-client through VTY.

Related: SYS#5091
Related: SYS#5987
Change-Id: I7670ba56fe989706579224a364595fdd4b4708ff
2022-10-19 18:27:15 +02:00
Keith Whyte ba4d682b70 Change CC_CAUSE returned on unanswered MT Call
The timer "mgw X2" (RTP stream establishing timeout)
is set by default to 30 seconds.
When an MT call is ringing and remains unanswered, it
is this timer that will expire, and the call is terminated.

Up to now this results in a CC_CAUSE of Resource Unavailable
and if osmo-sip-connector is in use, the SIP agent will
get 503 Service Unavailable.
While "resource unavailable" may be technically correct, in
that the MGW did not return an rtp stream in time, returning
"No User Responding" (resulting in SIP 480) is probably a
more accurate description of what actually happened,
allowing the switch to inform the caller.

Change-Id: I4a9cfc388ec9ecb743d154a114a6db638eac4701
2022-10-03 19:16:14 +00:00
Vadim Yanitskiy eab86612d3 mncc: cosmetic: fix coding style in mncc_prim_check_sign()
Change-Id: I94d9cba7aca19f28c906e05dd86bfe3020abd5b1
Related: OS#5282
2022-10-03 16:20:05 +07:00
Vadim Yanitskiy 8e15c797ca mncc: move MNCC_F_ALL from mncc.c to mncc.h
Move it closer to the other MNCC_F_* entries, so that it's more
likely that it gets updated when new flags are added.

Change-Id: If1a12a696b87184c9eee14f475594c317927427b
Related: OS#5282
2022-10-03 16:20:01 +07:00
Keith Whyte fdfe0c23ec Update MNCC field validation mask.
In c6921e5068, 0x4000 was added to the
possible MNCC field flags, but before this commit, using it would
result in an ERROR of "Unknown MNCC field mask 0x....."

Related: OS#5282
Change-Id: I9e7d224e7f2d6d2824b2466752b6e8c994ac5a3d
2022-10-03 15:39:11 +07:00
Max 5346f69a54 Introduce libsmpputil
As part of preparation for libosmo-netif migration let's move common SMPP code
into separate build-time library and use it for both smpp_mirror and OsmoMSC
renaming the files if necessary.

While at it we also fix id/password legth limits in smpp_mirror and drop unused
fields from ESME struct.

Related: OS#5568
Change-Id: I61910651bc7c188dc2fb67d96189a66a47e7e8fb
2022-08-05 22:12:09 +07:00
Max 1470d0b870 ESME: use osmo_sock_get_name() for logging
This allows us to drop single-use parameters from osmo_esme to facilitate further code changes.

Related: OS#5568
Change-Id: I34bd4c145b0f6287a323e2350808feb59f1d3187
2022-08-01 13:53:37 +00:00
Max 4b1202bfdf SMPP: clarify (re)start logic
Having smpp_smsc_stop() called from within smpp_smsc_start() instead of
explicitly inside smpp_smsc_restart() is confusing and could lead to
hard-to-trace bugs. Let's get this fixed first before going further.

Related: OS#5568
Change-Id: I353f5b82c9f5308d93e926538d4ef7e24d0b0339
2022-08-01 13:53:37 +00:00
Neels Hofmeyr d20dd22082 sdp_msg: s/sdp_audio_codec_/sdp_audio_codecs_
Some functions act on a struct sdp_audio_codecs but begin with the name
sdp_audio_codec (singular). That's confusing.

Related: SYS#5066
Change-Id: Id87eb350c1f17f8dbf776909824bfa06634c1d04
2022-07-25 14:25:07 +02:00
Neels Hofmeyr c9e0ca3d1f sdp_msg: add sdp_audio_codecs_cmp(), add compare flags
A problem with SDP fmtp handling is visible in this patch: when cmp_fmtp
is true, we compare fmtp strings 1:1, which is not how things should be
done. The intention is to fix fmtp handling in a later patch.

At least there now is a flag to bypass fmtp comparison altogether.

Related: SYS#5066
Change-Id: I18d33e189674229501afec950aa1c732386455a2
2022-07-25 14:25:07 +02:00