Project

General

Profile

Actions

Bug #6312

open

Querying HLR for MSISDN-to-IMSI mapping is too cumbersome and inefficient

Added by falconia 4 months ago. Updated 4 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
12/17/2023
Due date:
% Done:

0%

Spec Reference:

Description

Thanks to recently implemented features #3587 and #6135, we now have a way to connect an external SMSC to an OsmoMSC+OsmoHLR core network. However, there is one remaining difficulty: when that external SMSC needs to deliver MT SMS to a subscriber, the mechanism of SMS-over-GSUP requires that the target MS be identified by IMSI, while the SMSC will typically only have MSISDN for the recipient. Elaborating a little:

  • IMSI is a strictly required IE in every GSUP message, and the design of GSUP thoroughly assumes that every entity that initiates a GSUP exchange (beginning with a request message) knows the IMSI it wishes to operate on.
  • Because of the previous point, I don't see an obvious way to add an exchange of "I only know MSISDN, please tell me the corresponding IMSI" to GSUP. What would the requestor put into the mandatory IMSI field of the request message? A dummy? Would the response then replace that dummy with the real IMSI and thus no longer match? Various common GSUP code paths will likely break then - hence this type of query just doesn't seem to fit into GSUP architecture.
  • The basic paradigmatic principle that MT-SMS recipients are identified by IMSI rather than MSISDN at the low-level MT delivery protocol level seems correct: one can think of special cases of network-originated SMS (e.g., SIM OTA programming) in which a recipient may not have an MSISDN at all, but does have an IMSI and is thus attached to GERAN or UTRAN. Hence it seems logically correct to me to have MSISDN-to-IMSI resolution as a separate step just prior to actual MT SMS delivery attempt.

One currently workable approach is to have the external SMSC connect to OsmoHLR not only via GSUP, but also connect to OsmoHLR ctrl interface, issue ctrl GET queries for subscriber.by-msisdn-XXXX.info and fish the IMSI out of the verbose multiline ASCII-formatted response. My current plan is to implement this cumbersome and inefficient MSISDN-to-IMSI resolution mechanism in ThemWi-SMSC (my current real-life-need use case for an external SMSC connecting to Osmocom CN), but it would certainly be nice to have a better way. I also reason that a more efficient and more logically sensible way of doing this mapping resolution will be needed before the approach of a separate SMSC (split from OsmoMSC) can become Osmocom mainstream.

One easy-to-implement relief measure would be to add a subscriber.by-*.imsi ctrl variable (like subscriber.by-*.msisdn, but read-only). The benefits will be shorter TCP-carried messages on the ctrl connection for MSISDN-to-IMSI queries, and simpler parsing code in the SMSC - no need to fish the IMSI out of lots of other irrelevant info. But the whole idea of using this ctrl interface for a key internal function still feels philosophically wrong. Any better ideas?


Related issues

Related to OsmoHLR - Feature #6135: Implement routing of SMS-over-GSUP messages between connected MSC/VLRs and SMSCsStalledfalconia08/07/2023

Actions
Actions #1

Updated by falconia 4 months ago

  • Related to Feature #6135: Implement routing of SMS-over-GSUP messages between connected MSC/VLRs and SMSCs added
Actions #2

Updated by falconia 4 months ago

fixeria and I have been discussing this issue, and there does not seem to be any easy, simple solution. The fundamental obstacle to adding an MSISDN-to-IMSI lookup or query transaction to GSUP (or allowing MT-forwardSM.req to be routed directly by MSISDN rather than IMSI) is that the design of GSUP thoroughly assumes that (a) every request message, no matter what type, already has a valid IMSI in it and (b) this IMSI is strictly matched between the request and the response. Here is an example of where these two rules are currently enforced for all GSUP messages, no matter what type:

https://cgit.osmocom.org/osmo-hlr/tree/src/gsupclient/gsup_req.c?id=be8bcd30ebf4218270d9835399260b7390d2eba6#n156
https://cgit.osmocom.org/osmo-hlr/tree/src/gsupclient/gsup_req.c?id=be8bcd30ebf4218270d9835399260b7390d2eba6#n343

The first requirement (valid IMSI present in request) will be violated whether we add a separate MSISDN-to-IMSI lookup query or allow MT-forwardSM.req to be sent without known IMSI, to be routed by MSISDN. And if we implement a separate MSISDN-to-IMSI lookup query, which feels architecturally more proper to me, then we also violate the second requirement: the response will have the IMSI where the request had it lacking.

So what do we do? Do we add MSISDN-to-IMSI lookup request and response message types to GSUP and make them a special exception, exempt from the "perfect" IMSI requirement, and patch gsup_req code to treat this one message type as special and exempt? Aside from ugliness, this approach can cause breakage - code that currently assumes that the IMSI has already been validated, always, will break.

Here is a crazy idea: what if we invent a "companion" protocol that exists alongside GSUP? GSUP messages are already encapsulated in IPA multiplex, and we got a specific IPA Osmo protocol extension ID byte. What if we define another subchannel (a different IPA Osmo protocol extension ID byte value) on the same IPA TCP connection that carries GSUP, and have that separate subchannel carry lookup query request-response exchanges?

Either way, we will need some solution if the idea of SMSC factored out of OsmoMSC (and perhaps working with OsmoSGSN too, for SMS over GPRS) is ever to become Osmocom mainstream, beyond people like me who currently need it badly enough to settle for a hack like connecting to OsmoHLR CTRL interface and querying that one.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)