Note that I am not a real engineer and so I'm speaking as a semi-informed amateur.
Modern cars all have a Controller Area Network Bus (CAN Bus) or something very much like it, where events are sent from sensors and commands are sent from controller modules. There may (or may not be) also a Local Interconnect Network Bus (LIN Bus) for non-critical systems such as climate control and "infotainment" systems.
The CAN Bus architecture is remarkably similar to Ethernet.
There are sensors within the car, typically accelerometers built into microchips. I believe that those sensors are wired directly into the ECUs for the various airbags rather than sending events over the CAN Bus. Once the sensors send events, the ECU for the airbag(s) the sensor is wired to evaluates the signals and compares them to stored values for "this is a crash the indicates this specific airbag should be inflated." Once that ECU fires the airbag inflator, it sends events indicating the inflation over the CAN Bus to OnStar or the competing system, which then initiates contact with the call center. Seatbelt pretensioners will also fire, with (I believe) the airbag ECU instructing the seatbelt ECU to do so (rather than being the same ECU).
Integrating these devices, systems and programming correctly into a car that doesn't have them from the manufacturer would almost certainly be more expensive than buying the new car. The programming effort alone would be pretty epic.