Open access peer-reviewed chapter

Prepaid Voice Services Based on OpenBTS Platform

By Ladislav Behan, Lukas Orcik, Filip Rezac, Ivan Baronak and Jerry Chun Wei Lin

Submitted: September 5th 2017Published: November 2nd 2017

DOI: 10.5772/intechopen.71099

Downloaded: 586

Abstract

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.

Keywords

  • GSM
  • OpenBTS
  • Asterisk
  • smqueue
  • Subscriber Registry
  • SIP
  • IAX
  • USRP
  • C++
  • PHP
  • trunk
  • VoIP

1. 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 low-capacity 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 non-difficult 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 [911].

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.

2. 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].

Figure 1.

OpenBTS architecture [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).

Figure 2.

OpenBTS USRP N210 from Ettus Research [9].

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 by smqueue. The core of smqueue is a queue of messages that are waiting for delivery. They wait in this queue, potentially during multiple delivery attempts, until they are successfully delivered or until messages are determined to be undeliverable. The function of smqueue server is similar to email server [1].

3. Design and implementation of accounting services

Figure 3 shows connection scheme of OpenBTS network. Asterisk, OpenBTS, smqueue and sipauthserve are running on PC with the assigned IP address (158.196.229.242). A network switch connects PC, USRP N210 and IP phone together. In this topology, Asterisk is connected to two other Asterisk servers via IAX and SIP trunk. There are softphones connected to both of these servers.

Figure 3.

Connection scheme of OpenBTS network.

Now we can connect any mobile station (MS) to our created network. If the connection was successfully established, the IMSI number of the phone SIM card is stored in the TMSITable database. We created a C++ program that continuously checks this database for a new IMSI records. If the new IMSI appears, then this program will check whether the record exists in sip_buddies table. If sip_buddies table does not contain this IMSI number, then program will generate a phone number, inserts a record to this sqlite3 database and modifies the configuration files of Asterisk.

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).

Figure 4.

Automatic IMSI registration in OpenBTS network.

Figure 5.

OpenBTS welcome message.

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.

Figure 6.

Summary of calls table.

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.

Figure 7.

Number of calls made per month.

Figure 8.

Number of text messages sent per month.

Figure 9.

Total money spent on service per month.

4. 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 10.

Program flow of cdr_manager.Cpp.

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.

Figure 11.

Low credit balance message.

5. 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.

Figure 12.

Call_manager.cpp flow.

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).

Figure 13.

Zero credit text message.

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.

6. 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:

Mar 2 15:03:22 studentPC smqueue: NOTICE 4842:4848 2016-03-02 T15:03:22.1 smqueue.cpp:2455:main_loop: Got SMS rqst qtag ‘658,054-- OBTSbwgdfkphscqborwe’ from IMSI230024701231026 $.

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).

Figure 14.

Sms_manager.cpp flow.

7. 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.

Acknowledgments

The research presented in the paper was supported by the SGS grant no. SP2017/174, VSB–Technical University of Ostrava, Czech Republic.

© 2017 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution 3.0 License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

Ladislav Behan, Lukas Orcik, Filip Rezac, Ivan Baronak and Jerry Chun Wei Lin (November 2nd 2017). Prepaid Voice Services Based on OpenBTS Platform, Proceedings of the 3rd Czech-China Scientific Conference 2017, Jaromir Gottvald and Petr Praus, IntechOpen, DOI: 10.5772/intechopen.71099. Available from:

chapter statistics

586total chapter downloads

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

Related Content

This Book

Next chapter

Study of Admission Control Methods for IPTV Services

By Erik Chromy, Tsu-Yang Wu, Roman Cipov, Matej Kavacky, Stanislav Klucik, Ivan Baronak and Lukas Orcik

Related Book

First chapter

Parallel Iteration Method for Frequency Estimation Using Trigonometric Decomposition

By He Wen, Junhao Zhang, Radek Martinek, Petr Bilik and Zidek Jan

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us