Prepaid Voice Services Based on OpenBTS Platform

This article describes the design and implementation of prepaid voice services based on OpenBTS platform. By using various programming languages and open-source software tools, we can integrate prepaid voice services with this system, so its functionality is resembled as much as possible the operation of traditional GSM network provider. This article also provides description of how customers will approach their billing services, how they will access their accounts and pay their invoices.


Introduction
Recently, GSM system is increasingly attracting the attention of the open-source community. Software implementation of the traditional GSM network would allow it to operate at much lower costs and would provide easier control over the entire system. The GSM network architecture is a remarkable piece of technology that many technicians developed for a very long time. It is very robust and also scalable but on the other side, quite inflexible and too expensive. Many open-source projects were built in order to address this. For example, Osmocom, OpenLTE, and YateBTS and Open Base Transceiver Station (OpenBTS) [1,2]. Each project was built with different targets and architectures, tackling weak spots of traditional network in its own way.
Linux application OpenBTS (Open Base Transceiver Station) is one of the projects that allows user to create GSM network based on a software implementation. Due to economic software design and proper selection of powerful amplifiers, it allows user to install and operate a lowcapacity GSM network at one-tenth of the cost of current technologies only. This project implements the GSM air interface (Um) that allows cellular handsets to be used as SIP endpoints. It provides Um interface by Universal Software Radio Peripheral (USRP) [3]. There are still many areas on the Earth that do not have mobile network coverage or even telephone lines at home. But, they do have an Internet connection via satellite or long-haul WiFi. OpenBTS is able to convert and distribute this Internet connection as a mobile network across a large geographic region. This solution is suitable for building GSM in extreme conditions and the achieved PESQ quality [4] of such solution is presented in several papers [5,6]. Any mobile phone connected to this network can transmit basic data, use voice services or send text messages. The combination of OpenBTS and USRP changes the way we should think about mobile networks. This technology allows user to build a complex radio network purely based on open-source software tools. OpenBTS is written in a C++ programming language and this application implements the whole GSM stack. OpenBTS is just a software. You can make it do whatever you would like, so OpenBTS network's capabilities can be enhanced with a nondifficult software update. The mobile network is finally open for innovation and anyone is able to build experimental cellular network now [7,8].
There is no need for any configuration changes on the mobile stations, because the radio interface of OpenBTS network is equivalent to mentioned GSM network. The core of an OpenBTS network is composed of open protocols and IP is used as its transport protocol. Many software projects already exist and implement these open protocols, but there were some new components developed in order to provide a functionality to link the GSM and IP technology. Additionally, there are various applications providing efficient tools for the investigation of the GSM security issues [9][10][11].
The rest of this paper is organized as follows: In Section 2, the OpenBTS project is described in detail. Section 3 shows the design and implementation of accounting services integrated to our custom cellular network. Method of charging for voice is presented in Section 4. In Section 5, the application of control of exceeding the limit of prepaid services is presented. Section 6 describes how text messages are monitored in our network. Section 7 concludes the paper.

OpenBTS and its architecture
OpenBTS implements a complete GSM stack for voice, SMS and allows calls between registered mobile stations within created network and also between different network providers. These networks can be used to support true fixed-mobile convergence, bring coverage to remote areas or experiment and innovate within the cellular network itself. Because OpenBTS converts both cellular signaling and media directly to SIP [12] and RTP [13], the integration environment is quite familiar [14].
As mentioned earlier, OpenBTS itself is written in the programming language C++ and uses Asterisk PBX to place calls. Asterisk also allows this system to connect to various private or public IP networks. Mobile stations connected to OpenBTS network can reach each other even if the system is not connected to the Internet, but reaching someone outside the network requires an Internet connection. This new "hybrid" architecture is illustrated in Figure 1 [15].
The crucial element of the whole OpenBTS architecture is a product of the Ettus Research, USRP. This is a relatively inexpensive hardware that is easily adaptable to GSM transmitter.
USRP system consists of a motherboard which can be easily extended by the additional cards to provide and transmit signals with different frequency bands. It also consists of an USB interface, through which it communicates with the computer and a programmable FPGA. Motherboard contains A/D and D/A converters, processor interface and the controller power system to generate and synchronize clocks and FPGA. USRP needs UHD for a proper functionality. UHD is an open-source driver that is compatible with all operating systems and it is possible to use with LabView, GNU Radio or OpenBTS ( Figure 2).
Sipauthserve is an application that implements Subscriber Registry, the database of subscriber information that takes place at both the Asterisk SIP registry and the GSM Home Location Register (HLR) that can be found in a conventional GSM network. The delivery of each text message in OpenBTS network depends on a store-and-forward facility. This facility is provided   As you can see in Figure 4, if MS successfully connects to OpenBTS network, it will obtain a welcome message with information about its generated phone number and IMSI number. With these numbers user is able to login onto his account at the service provider's website where he should activate voice services. Every generated phone number or IMSI number is unique so there is no possibility to duplicate a data. After user's successful logging, the welcome page should appear with a main menu where user can choose from following items: Services, Statistics, Summary and Contact. After opening the Services tab, users are offered to be able to activate various services. They are able to choose either one of the credit services or activate one of the fixed payment tariffs ( Figure 5). Each button containing a prepaid voice service is connected to the PayPal Internet-based payment system. After choosing preferred service, user will be redirected to PayPal website, where he will be asked to pay the amount for the specific tariff. In the Summary tab, see Figure 6, there is possibility to review all calls that have been made retrospectively. This table shows to which extensions user was calling and to which network area this number belongs. Then he can view the total duration of the call with exact start and end time of the call. Last item is showing the amount charged for this call. User is also able to download this entire summary report as a PDF file. Files are created by the FPDF tool that is a PHP class which allows to generate PDF files.
The Statistics tab consists of individual statistics. For example, as we can see in Figure 7, the user is able to view the number of calls he made in each month. The number of text messages he sent is shown in Figure 8 and the total amount of money paid for voice services is shown in Figure 9. These graphs are generated by object-oriented PHP library JPGraph that is processing user's data retrieved from a SQL database.

Method of charging for voice services in the OpenBTS network
Phone calls in OpenBTS network are routed via the Asterisk PBX that stores detailed records related to these calls in the Master.csv file. Asterisk stores these calling data records (CDR) to this csv file after every call is processed. CDR records consist of very important data for our billing system implementation. For example, the phone number of the subscriber originating the call, the phone number receiving the call, the call duration or the starting time of the call (date and time).
We implemented a C++ application that parses these CDR records from Master.csv file and stores them to various databases used in our billing system. This application is continuously checking Master.csv file for a new record. If a new CDR record has been added, application  will find out what is the user's activated service. If he has activated one of the tariff services, then the total call time will be subtracted from the rest of his free prepaid minutes. If he has activated the credit service then the resulting sum of the call will be calculated in accordance of where the call was routed (IP phone, SIP/IAX trunk, MS). Figure 10 shows the flow of cdr_manager application when the new CDR record has been found. Figure 11 shows that application also checks if the user's credit balance is not too low. If it finds out the remaining credit is under 20 CZK then it will send a notification message to him.

Control of exceeding the limit of prepaid services
Another essential part of our billing system is to check if the caller did not exceed his limit of prepaid services during the active phone call. We implemented an application call_manager. cpp that constantly monitors occupancy of Asterisk PBX channels. Figure 12 shows the flow of this application.
As we have mentioned, the whole process starts with constantly enquiring Asterisk about the state of the call channels. If Asterisk confirms that there has been an active channel found, the call_manager checks if a caller extension has its prepaid service active. If not, the  application will terminate this channel immediately and the following text message is send to MS ( Figure 13).
If the user's account is non-zero then the application will determine whether the call will be routed through SIP/IAX trunk, IP Phone or call will be made on the OpenBTS network. Based on that data our application will determine the time for how long is the caller able to use the voice channel.
In cases when the time limit has exceeded, the voice channel will be terminated immediately, the program opens a database containing information about the caller's prepaid services and set them to zero. At that point, the user will be informed about the zero balance of his account via SMS. He is also invited to visit the service provider's website to reactivate his service, otherwise he will not be able to make calls or send any text messages.

Text message billing
Another important part of our billing system is a way to monitor sent text messages. In this case, we implemented application that is parsing messages stored in OpenBTS.log file. This program regularly monitors mentioned file and select only messages with specific content like the following example: The other application sms_manager.cpp then parses this message and picks information about IMSI number. According to this IMSI number, program checks the user's service and its status. If he has activated one of the tariff services then the total free text messages is subtracted by 1, in case of a credit service there is a fee charged for this text message. The program then updates the database that indicates the number of messages sent per month. As mentioned earlier, these statistics are then graphically available on the service provider website ( Figure 14).

Conclusion
In this article, we demonstrated the possibility of creating a billing system working correctly in conjunction with the OpenBTS platform and providing an important part of the mobile operator system based on OpenBTS. First of all, we automate the registration of IMSI numbers, which means that after the phone is registered to the network, the phone number is automatically assigned to it. This author's contribution in community of OpenBTS project. Using various software tools and programming languages, we have implemented our own billing system that we integrated to OpenBTS system and it led to low-cost mobile operator creation. Last that is missing to completeness is data service integration that can be provided by integrating OsmoSGSN a OpenGGSN nodes to our system. OpenBTS system proves that nearly anyone can run a custom GSM network with parts from a home-supply or auto-supply store. The technology required to build this kind of network is no longer far too expensive, nor has a fistful of big companies locked them down. Mobile phone users within this network are able to make calls to each other and if the network is connected to the Internet, they can make calls to people around the world.
Contribution of this paper lies in an experimental development of the solution for mobile operators which is based on the OpenBTS platform with widely available USRP HW and SW tools implemented within this experimental research. The solution can be operated in areas, where mobile operators do not cover, and no mobile infrastructure exists, especially on islands.