EU-Roaming - Roaming just in some countries

What I’d like to see:

an additional option to either enable just EU-Roaming or to select sime countries in which roaming should be enabled

How is the current situation:

Roaming is either on or off for all foreign countries.

Background:

  • You are traveling abroad near the borders of an EU-country and a Non-EU-country and have the usual eu fair use policy in your contract.
  • Don’t want to pay the (very) high prices for data link in the non eu country.
  • I now preselected a specific network operator, but that’s kind of workaround and not a real solution. Because SFOS could select another provider if traveling further.

I’m sorry if the formatting dies not fit: send from SFOS-forum viewer. It doesn’t seem to preview markdown.

12 Likes

I would vote for this! It’s a problem on iPhones as well.

The “free roaming in EU” has been extended by another 13 years, so this is an issue that will be with us for some time!

2 Likes

A blacklist of providers the phone shall not connect with, would be fine. So some non EU or too expensive networks could be excluded from roaming.

2 Likes

Yes! This feature will be incredible useful.

1 Like

this is similar to what I was asking here:

5 Likes

I’m sorry. Of course I searched but obviously I was not able ti find your feature request.

No need to say sorry :slight_smile: I only linked it here so we can know about this. As you can see right now there’ are 11 peoples that would like to see these features :slight_smile:

Another vote for this – not only for out-of-country roaming, but it’d also be useful when providers share networks (I’m with a smaller provider, which has an agreement with a bigger national provider to use their network, and I can use either; using the bigger provider’s network doesn’t count as roaming when billing).

1 Like

I’d also love to see this feature, so count me as another vote for it.

1 Like

Out of curiosity: is this possible on iOS or android?

1 Like

No, this feature does not exists in android. Someone mentioned, that it doesn’t exist in iOS as well.
But why shouldn’t SFOS be some steps a head? :wink:

4 Likes

I have a problem with a carrier that keeps being selected when roaming that does not work correctly. Being able to blacklist it would be very useful.

1 Like

Interesting idea.

Ofono does have an interface to disable/enable roaming, maybe something like this:

could be expanded to make a prototype blacklisting implementation (e.g. disable roaming if a blacklisted network is detected).

Is there a list of country (and network) codes which classify as such “border-to-eu-roaming” networks?

1 Like

ok, that’s something worth investigating, thank you!

1 Like

This register-operator can be interesting too.

Speaking of 4.4.0.72 and the Xperia 10 III roaming throughout the EU would be great anyway.
Due to some personal reasons I only visited Poland, Switzerland and Austria in 2022. Roaming for telephony went fine everywhere but I had problems with mobile data in Austria.

Roaming is seriously broken.

I had no problems with my X and XA2 all around Europe before.

Swiss or liechtenstein is ‘bad’

Albanien

Andorra

Bosnien und Herzegowina

Britische Kanalinseln

Färöer-Inseln

Isle of Man

Kasachstan

Kosovo

Mazedonien

Moldawien

Monaco

Montenegro

Russland

Schweiz

San Marino

Serbien

Türkei

Ukraine

Vatikanstadt

Weißrussland

1 Like

Thanks for that.

The python approach works, one only needs to get the mcc and mnc codes from the mobile provider info xml to construct the blacklist.

Then listen on the ofono dbus for network change events and disable roaming if mcc and/or mnc match entries in the blacklist.

1 Like

Please test and expand on the script below.
I don’t speak python well so I’m sure it can be improved. Also I could not actually test it, as I’m not currently within range of one of those countries.

What it does:

  • listen on ofono interface for operator changes
  • compare “current” (i.e. used) network ID with blacklist
  • if net is blacklisted, disable roaming (actually, it just prints something, if you want to really disable roaming, uncomment the connman.SetProperty part).

It’s not ideal, because what we really want is to select an non-blacklisted operator instead of disabling Roaming, but I guess that’s within ofono…

This can be run from a systemd service, for now, just run from command line.

Config file


{
"providers": [
        { "name": "Albania",                    "mcc": "276", "networks": [ "01", "02", "03" ] },
        { "name": "Andorra",                    "mcc": "213", "networks": [ "03" ] },
        { "name": "Bosnia and Herzegovina",     "mcc": "218", "networks": [ "90", "05", "03"] },
        { "name": "Faroe Islands",              "mcc": "288", "networks": [ "01", "02", "03"] },
        { "name": "Isle of Man",                "mcc": "234", "networks": [ "58", "36" ] },
        { "name": "Kosovo",                     "mcc": "221", "networks": [ "01", "02", "03" ] },
        { "name": "Macedonia",                  "mcc": "294", "networks": [ "01", "03" ] },
        { "name": "Moldova",                    "mcc": "259", "networks": [ "01", "02", "03", "05", "99", "06" ] },
        { "name": "Monaco",                     "mcc": "212", "networks": [ "10 "] },
        { "name": "Montenegro",                 "mcc": "297", "networks": [ "01", "02", "03" ] },
        { "name": "Russia",                     "mcc": "250", "networks": [ "01", "02", "99", "20" ] },
        { "name": "Switzerland",                "mcc": "228", "networks": [ "01", "02", "03" ] },
        { "name": "San Marino",                 "mcc": "222", "networks": [ "01" ] },
        { "name": "Serbia",                     "mcc": "220", "networks": [ "01", "03", "05" ] },
        { "name": "Turkey",                     "mcc": "286", "networks": [ "01", "02" ] },
        { "name": "Ukraine",                    "mcc": "255", "networks": [ "03", "01", "06", "04", "07", "21" ] },
        { "name": "Belarus",                    "mcc": "257", "networks": [ "01" , "02", "04"] }
        ]
}

Python daemon

#!/usr/bin/python3

import sys
import dbus
import json

from gi.repository import GLib
import dbus.mainloop.glib

# load list of countries not in EU Roaming arreement
noneu_f = "./noneu.json"
f = open(noneu_f)
noneu = json.load(f)
f.close()

# array of string, countrycode dot networkcode
blacklist = []

print ("Blacklisted Non-Eu-Roaming Countries:", file=sys.stderr)
for p in noneu['providers']:
        print ("%s" %(p['name']), file=sys.stderr)
        ncc = p['mcc']
        for net in p['networks']:
                blacklist.append( ncc + "." + net )

# TODO: list could be crosschecked/updated from here:
#provinfo_file = "/usr/share/mobile-broadband-provider-info/serviceproviders.xml"
#print("Constructed Blacklist: %s" % (blacklist), file=sys.stderr)

### initialize DBus
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'), 'org.ofono.Manager')
modems = manager.GetModems()

#### handle DBus signals from main loop:
def signal_handler(message):
        print("Got Message: %s" % (message))
        checkRoamingAllowed()

def checkRoamingAllowed():
        for path, properties in modems:
                if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
                        continue

                netreg = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.NetworkRegistration')
                ops = netreg.GetOperators()

                code = ''
                for op, properties in ops:
                        # Name Status MobileCountryCode MobileNetworkCode Technologies
                        #print("Operator: %s\n\tName: %s\n\tStatus: %s\n\tCountry: %s\n\tNetwork: %s\n\tTech: %s" % (op, properties.get('Name'), properties.get('Status'), properties.get('MobileCountryCode'), properties.get('MobileNetworkCode'), properties.get('Technologies')))
                        if properties.get('Status') == "current":
                                print("Current Operator:\n\tName: %s\n\tStatus: %s\n\tCountry: %s\n\tNetwork: %s\n" % (op, properties.get('Name'), properties.get('Status'), properties.get('MobileCountryCode'), properties.get('MobileNetworkCode')))
                                code = properties.get('MobileCountryCode') + "." + properties.get('MobileNetworkCode')
                                country = properties.get('MobileCountryCode')

                if code in blacklist or country in blacklist:
                        print("Network or Country blacklisted, disabling roaming.")
                        allowed = dbus.Boolean(0)
                else:
                        allowed = dbus.Boolean(1)
        setRoaming(allowed)

def setRoaming(allowed):
        for path, properties in modems:
                if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
                        continue

        connman = dbus.Interface(bus.get_object('org.ofono', path),
                                        'org.ofono.ConnectionManager')

        print("Setting %s to RoamingAllowed=%d" % (path, allowed))
        #connman.SetProperty("RoamingAllowed", allowed)

if __name__ == '__main__':
        loop = GLib.MainLoop()

        for path, properties in modems:
                try:
                        object = bus.get_object("org.ofono", path)
                        object.connect_to_signal("OperatorsChanged", signal_handler, dbus_interface="org.ofono.NetworkRegistration")
                        print("Listening for operator changes on %s" % (path), file=sys.stderr)
                except dbus.DBusException:
                        traceback.print_exc()
                        sys.exit(1)

        loop.run()

5 Likes