Hello Osmocom community,
I have previously alluded in other threads here that I am seeking to interface my Osmocom-based GSM network to USA PSTN. In this post I shall provide details as to exactly what I am doing and how I go about it.
I am currently experimenting with using bulkvs.com as my USA PSTN connectivity provider, chosen on the basis of cost economy: it is incredibly, mind-boggling cheap - the monthly "keepalive" cost is only 6 cents (yes, *cents*) per rented phone number! With phone numbers this cheap, I don't have to do any kind of "number economy" options: no need for "phone number NAT" (a single external phone number where a PBX answers, requiring callers to then dial an internal extension number), and no need for a mixed scheme where only one or two test SIMs get real outside numbers while all others get only fake internal numbers - instead I can give a real valid NANP phone number to every test SIM on my test/R&D GSM network. For context, my test GSM network is envisioned as serving two purposes: one is for development and testing of GSM handsets - real phone numbers are less important here - and the other purpose is demonstration to gathered audiences (American patriots and in-person freedom lovers who aren't afraid of some silly virus) for "oooh and ahhh" - and for this second purpose, having real phone numbers for every test phone will be a big boost.
The interface to USA PSTN provided by bulkvs.com and other similar low-cost services is a SIP trunk, hence what I need to implement is a form of GSM to SIP gateway. But here is the part where I deviate from what appears to be the established canon in Osmocom-based community cellular networks: I don't want to run a heavyweight PBX like Asterisk or FreeSwitch, instead I want to run only a fairly thin, lightweight layer of extra sw between my OsmoMSC instance (MNCC interface) and the public-Internet SIP interface provided by bulkvs, with the needed thin sw layer put together by me, combining newly written code specific to my use case with bits of code borrowed from elsewhere.
Here is the code I have written / put together so far:
https://www.freecalypso.org/hg/themwi-system-sw/
The README file at the top level of the code repository explains what is there and how it works, in basic terms.
One of the major pieces I will need to implement is an RTP bridge MGW that will transcode between GSM codecs (FR1, EFR, AMR) on the GSM side and G.711 (PCMU or PCMA) on the PSTN-via-SIP side. PSTN-via-SIP connectivity providers such as bulkvs don't support any GSM codecs (not one of them), instead they only support G.711 and G.729. I won't be doing G.729 in ThemWi (transcoding from one lossy vocoder to another seems like a terrible idea), hence I will run with G.711 on my PSTN-over-Internet interface and I will need to implement a transcoder between GSM codec family and G.711. I reason that what I need to implement is probably quite similar to the transcoding function in classic GSM E1 TRAUs, except that in the RTP bridge environment I also have to deal with the added complexities of packet loss, reordering and silence suppression, unpleasantries of the packet world that didn't exist in the olden days of TDM luxury.
I don't know whether or not a transcoding RTP bridge MGW is already implemented somewhere in the bowels of either Asterisk or FreeSwitch - the size and complexity of both "major sw" choices is quite intimidating and off-putting. If someone who happens to know the answer gives me a pointer, it will certainly be very appreciated, but if not, then some time later I will undertake the big effort to dig in both projects and look for this transcoder. If the needed transcoder implementation already exists somewhere, then I will need to lift it out of whichever project and integrate it into themwi-system-sw - and if there is no existing published-source implementation, then I will be the first to produce one.
M~