RR Channel Release and USSD
Traditionally we have a struct gsm_lchan representing a logical channel. It has a given type based on the physical allocation (SDCCH, TCH/H, TCH/F), a given mode (traffic or signalling) and the trx and timeslot it is on. We also have a struct gsm_subscr representing a GSM Subscriber in our combined HLR/VLR. Whenever a Channel is used for a subscriber we are taking a reference count and assign the subscriber to the lchan. Whenever releasing the lchan we check the subscriber pointer and if it is set send a proper RR Channel Release and a SACH Deactivate.
For the real OpenBSC BSC we have no HLR/VLR in process, we have no local database as I am paranoid on running out of diskspace on a system that should work without maintainenance. But this means that on a channel release I am not running through the GSM04.08 RR Channel Release and so far this has worked out well. Well until we have figured out that USSD is broken. The workaround for now was to create one dummy GSM Subscriber and assign it to the channels, the proper fix is on the way by a proper split between BSC and MSC functionality but that is taking quite some time.