I am using strongswan-epdg to connect to the T/Mobile ePDG, following the guide at VoWiFi with Asterisk - Open Source IMS Client - Open Source Mobile Communications
I can establish an IPSec connection to the ePDG, connect to the P-CSCF and send a SIP REGISTER. It responds with the 401 containing information to set up the IPsec connection to the P_CSCF, which I’m planning to work on next.
However this only works with a several year old T/Mobile SIM that I have. Neither a Tello SIM nor T/Mobile SIM I’ve obtained within the last few weeks is able to establish the initial IPsec connection to the ePDG, they fail IKE as Unauthorized.
I believe these two new cards which don’t work are because they store their IMSI only in MF/ADF.USIM/EF.IMSI while the old card additionally stores its IMSI in MF/DF.GSM/EF.IMSI. I’ve verified this using pySim-shell’s export --json function.
So for example the code in strongswan-epdg/src/libcharon/plugins/eap_sim_pcsc/eap_sim_pcsc_card.c at cea991aea81c0ea03dbb037e9dd9cf1be20b001e - ims-volte-vowifi/strongswan-epdg - Osmocom gitea which only looks at MF/DF.GSM/EF.IMSI won’t succeed on the new cards.
I’m trying to add MF/ADF.USIM/EF.IMSI support in strongswan-epdg’s eap_sim_pcsc_card.c, though I’m struggling with it. I have TS 31.102 open. I think I need it to determine early on whether it is talking to a USIM or not, to fetch a different set of APDUs.
So, my questions:
- Does this conclusion sound plausible?
- I could try to read DF.GSM and then ADF.USIM if it fails, but I’m worried I’ll eventually learn there are SIM cards out there which misbehave if one tries to fetch nonexistent APDUs. Is that a legitimate concern?