Commit Graph

323 Commits

Author SHA1 Message Date
Neels Hofmeyr 2fd69e15d3 fix VLR evil twin on LU with unknown TMSI
When a subscriber first attaches by TMSI only, and later tells the IMSI
via ID Response, it may turn out that this IMSI already exists in the
VLR database. If this happens, the TMSI that the subscriber issued was
not known in the existing VLR entry, indicating that the subscriber has
in the meantime camped on a different core. Which means we can assume
that there cannot be any active connections, and the old subscriber can
be discarded, for the benefit of the new one.

(We could also discard the new one, but it is more complex to reparent
the ongoing FSMs for Compl L3 than to copy some dormant VLR state.)

In vlr_subscr_set_imsi(), check for an existing IMSI entry in the VLR.

If such exists, copy any pending Paging and auth tuple state to the new
subscriber, and discard the old one from the VLR.

In order to safely discard a vlr subscriber by force, add a new vlr_ops
function: subscr_inval(), to tell the MSC that a vlr_subscr is no longer
valid.

Upcoming patch I583682d1a35a70b008d7bb2d89ba7c3109a60b21 better clears
TMSI state from the VLR, making it more likely to hit the evil twin
situation this patch fixes; hence this is, sort of, preparation.

Related: SYS#6860 OS#4721
Change-Id: Ifdabe0b65bffafbf7b8e5cc10e2d225d1ed1cecd
2024-03-28 04:06:58 +01:00
Neels Hofmeyr c8bf895a04 cosmetic: rename to sdp_audio_codecs_foreach()
Better match the pattern of sdp_audio_codecs_* instead of having
foreach_ in the front. Prepare for prepending osmo_ some day, because I
plan to move the SDP API to a separate library.

Change-Id: Ia96190e0bdb513886663be1c8c12be3b403b71c9
2024-02-08 23:42:17 +01:00
Neels Hofmeyr 100f8f9027 report caller's file,line in trans_cc_filter_run()
When we get the codec filter result logged, it is most interesting to
know the caller. So wrap a file-line macro around trans_cc_filter_run().

Change-Id: I243404487c1871e921b08098086ef2fc78a5561d
2024-02-08 23:42:17 +01:00
Andreas Eversberg 934f43bd1f Add LLC and HLC information to MNCC interface definiton
low/high layer compatibility are used for capability checking between
caller and called entitiy.

The information is added to the end of struct gsm_mncc increases, so
that the version number needs not to be incremented.

Related: OS#6152
Change-Id: I15f5afcf069ee6c1c4641108ceacc837bee311b5
2024-01-24 08:50:12 +00:00
Neels Hofmeyr 82fad5dd46 sdp: allow more space for fmtp
In osmo-mgw, we recently chose 256 for maximum fmtp length.
Adjust to that here, too.

Change-Id: Ib9b9608d8d8f7ce34596a950dbc480e8a72ebf97
2023-12-13 01:52:22 +00:00
Neels Hofmeyr d767c73a1f implement re-assignment to match codecs
This is the last missing piece that allows osmo-msc to make good TFO
codecs choices.

Since the codec_filter, osmo-msc properly gathers codec options and
limitations. But the MO call leg still assigns a voice channel before
getting a response from the MT call leg, and is then stuck with that.

Add the capability to adjust the MO call leg's codec in case the MT side
needs a different codec for TFO.

This is only relevant for 2G; on 3G we always have AMR/IuUP.

For inter-MSC handover, keep the behavior unchanged: offer only the
currently assigned codec to the remote side. Codec-changing HO should be
equally trivial to implement, but that is for another day.

msc_vlr_test_call's codec tests are adjusted to test the new feature in
Ib933554f826c1b4347dfa3f6c4f6fe086be8b133. For now, avoid change in
these tests by validating the first codec in SDP lists only.

Related: OS#6258
Related: osmo-ttcn3-hacks I402ed0523a2a87b83f29c5577b2c828102005d53
Change-Id: I8760feaa8598047369ef8c3ab2673013bac8ac8a
2023-12-13 01:52:22 +00:00
Neels Hofmeyr cefe594c72 add sdp_audio_codec_to_speech_codec_list()
Used by I8760feaa8598047369ef8c3ab2673013bac8ac8a to add just a single
codec to a speech codec list, instead of a list.

Change-Id: I6ac23c54bc26939e048ff2df06eb987421cfb1c5
2023-12-13 01:52:22 +00:00
Philipp Maier 656354b818 vlr_sgs: fix VTY setting for SGs counter.
When trying to modify the value of an SGs counter (eg. ns11), then the
setting is never stored. The reason for this is that OsmoMSC uses the
wrong string table to compare the user input.

Related: OS#6008
Change-Id: I0358c1ec0026c37fda6db1f3af3145393df25cfd
2023-10-30 17:12:46 +01:00
Mychaela N. Falconia dbe8889120 SMS over GSUP: set source_name in GSUP reply messages
For MO-forwardSM and MT-forwardSM request messages, OsmoHLR applies
routing based on the SMSC address for MO or based on the IMSI for MT.
However, reply messages following these requests are routed passively
based on the destination_name IE.  This passive message routing path
requires the source_name IE to be set as well - implement this
source_name setting.

Related: OS#6135
Change-Id: I0b7f4760bdce8a38d43d3860086c6dfb7b390701
2023-09-25 05:20:02 +00:00
Mychaela N. Falconia 02c49373f3 SMS over GSUP: correctly route GSUP responses to MT SMS
When OsmoMSC is used with OsmoHLR rather than a GSUP-to-MAP gateway,
MT-forwardSM.req GSUP messages delivering MT SMS will be coming from
a separate SMSC relayed via OsmoHLR, rather than from OsmoHLR itself.
When we reply to these messages, in order for these replies to reach
the MT-sending SMSC via OsmoHLR, we need to save source_name from
the request and regurgitate it into destination_name in our response
messages.  Implement this logic.

Related: OS#6135
Change-Id: I436e333035b8f6e27f86a49fe293ea48ea07a013
2023-09-25 05:13:49 +00:00
Neels Hofmeyr e80f556cd4 make two functions static
Change-Id: I1de0f35f1606c997777f34bbf4033e069aadbc64
2023-09-15 04:30:32 +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 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
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
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
Andreas Eversberg 0452cf9467 ASCI: Add log category for VGCS/VBS call and channel FSM
Change-Id: Icebc855fdc3f6ca7034ad3576b1acb5aed6bc435
Related: OS#4854
2023-07-09 07:41:33 +00:00
Andreas Eversberg b9162c7cc6 ASCI: Add log categories for GCC/BCC (call control)
Change-Id: I4c5d002b5bb1c2ebf2fac777ab784559fc265e7c
Related: OS#4854
2023-07-09 07:41:33 +00: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 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 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
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 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 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 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
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 4c57bb0476 [codecs filter] add trans.cc.codecs
Add the central codecs_filter for Call Control. The new member is not
used in this patch yet, subsequent patches will start to populate the
various stages of this codec filter, one by one.

Related: SYS#5066
Change-Id: Ib3fdeff8d1e1ea0760168d63ee6e1b1fb993aa5f
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 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
Neels Hofmeyr 01431080a3 sdp_msg.c: parse send/recv mode
Related: SYS#5066
Change-Id: I529c0bfad1cab376e26173ed48db2767c7dfaa64
2022-12-23 14:54:26 +00:00
Max 634591e85b SMPP: make smpp_smsc_stop() static
It's only used in a single file so there's no point exposing it via header.

Related: OS#5568
Change-Id: I3d0d850ffe6ebf9d623c1f250d4293a3c427d5d8
2022-11-21 16:31:05 +03: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