Microservices Architecture: Simplified


What is Microservices ?

Microservices (MS) is an architectural style for constructing applications. Its collection of small, loosely coupled collaborating services that works independently.

Lets understand by example: You are using a social media platform with features as Profile, News feed, Chat, Login, Share/broadcast etc. In Microservice style architecture, every services will be designed and developed separately irrespective of development language preference and technology stack. So here News feed will be a service may be developed in C++, Chat will be another service may be developed in another language Scala or Share/broadcast will be another services may be developed in Go or other languages. It gives flexibility to design and develop based on programming language of own preference. Every services will have their own sets of Database and controlled and managed separately but interact with each other to fulfil service requirement.

The Services communicate using either synchronous protocols such as HTTP/REST, WebSockets or asynchronous protocols such as AMQP.

As the every microservices will have their own sets of Databases and they may have to interact to fulfill service requirement, the data consistency between services is maintained using the Saga Pattern.

The advantage of using microservice based architecture are;

1- Every services will run and managed independently, hence if once services will be down then other services will remain active. This will turn outages of entire applications.

2- The maintenance, deployment and upgrade of each microservices will be independent and no dependency on another team/process.

3- Loosely coupled, highly maintainable and testable that enables rapid and frequent development and deployment (CI/CD).

Challenges with Microservices based architecture

1- Developers must deal with the additional complexity of distributed system:

Lets say, You have to get profile info of person using their profile ID then (i) in monolithic architecture developer will usually call a function similar like and pass on explicitly: getProfile (int profileID) and parse through single codebase.

In case datatype of profileID changed from int to string or char due to some business requirement then all the respective services which is using profileID as integer must change at a time of compilation otherwise it will throw compilation error.

However in Microservice based architecture, as all services are independent and you made changes of datatypes for profileID in only profile services then at the time of execution the service chain due to inter communication will break.

2– Increased memory consumption to to multiple service functions

How to Design Microservices based Architecture : Building blocks ?

1- Define Clients : Every microservices has its own clients or contracts. Lets say if profile microservice has to interact with News feed microservices to get news feed information about respective profile then it will interact with client of news feed and construct the object to get relevant news feed.

2– Define Mechanism for Routing the request : Here we can deploy load balancer or Service Registry (SR) to route the service request for subsequent microservices.

3– Define Continuous Integration and Continuous Deployment (CI/CD) process. As the deployment of each microservices are independent, we should have a automated CI/CD process. Using Jenkin or similar tools we can achieve this.

4– Define Service to Service communication establishment : Every microservices may have different way to interact between each other or with client. Lets say some microservices can be communicated with Message queue, some may be request-response based etc.

5- Define Distributed Logging : Each microservices have their own way to serving request and generating logs. In distributed system tracking of logs at every place will be challenging while troubleshooting for issues as services are interconnected. We should have distributed logging platform such as Elasticstack to capture all types of logs from different sets of microservices.

Cloud Native concept and building block


Last decade has seen huge rise in cloud computing. The worldwide public cloud services market is forecast to grow by 17% in Year 2020 as compared to Year 2019 (Reference Gartner Inc). The huge demands to server market need with agility have opened platform for several companies to gain competitive advantage to strategically transformed their ongoing/future business on cloud.

The cloud native is an approach to deliver business value by leveraging the cloud technologies and applications and build underlying architecture. In details, it’s a collection of loosely coupled independent services to provide a consistent development and automated management experience (CI/CD) across private, public, and hybrid clouds. Could Native is not about Servers its about Services. Like Infrastructure as a services, Platform as a services, Anything as a Services.

Let’s say you have to design cloud native system to run social media application. You can here leverage the advantage of available tools and architectural approach to automate the business process like cloud experience and deliver Services to customer

How to design Cloud Native: The design of cloud native includes cloud delivery model and several available tools integrated to integrate with CI/CD environment. The building block of cloud native includes.

1- Container– Containers are basic building blocks for Cloud Native to host applications. Container are enabling operating system virtualization to host application code and run anywhere. Docker is leading tool to create container.

2- Microservices: Microservice is an architectural concept to breaking up applications in loosely coupled way that allows application components to be developed, deployed, managed, and operated independently.

Let’s say you are using a social networking site which have features like Login, feed, Chat, News etc. Developing the site in Monolithic way must all the source code for all the services are integrated with each other, however in Microservices way you can create independent code base of login, feed, chat, and news services and they will interact with each other whenever required. They will be loosely coupled and production issues in any one microservice do not lead to application wide outages to other services. This makes it easier to contain production issues as well as respond and recover quickly.

3- Service Mesh: In Microservice architecture each separate applications to deliver services must interact with each other very frequently. In complex scenarios where hundred or thousand of microservices are deployed to fulfill the service requirement will increase overhead on service-to-service communication. Service mesh is helping to manage the communication at scale with reliability.

Service meshes have two main components: 1- the control plane and 2- data plane. Typically, the set of proxies are called the data plane and the task management processes are called the control plane. Istio, Cosul are market leading tools for creating service mesh.

4- Container Orchestration: While Docker will help you to create container to host application code, however it will not allow you to scale and ensuring high availability of applications. You would be required an orchestration tool which can enable you to manage these containers and hosted applications on the fly. The Docker has orchestration tool called Docker swarm however Kubernetes is more popular and industry leading tool.

5- Continuous Integration and Delivery: CI/CD is an automated approach with practices and sets of tools that is allowing to accelerate development lifecycle and releases with reliability. It’s also extended to the delivery and deployment stages to ensure new feature are production ready. Jenkins, Git, CircleCI, AWS CodeBuild etc. are leading CICD tools.

6- Cloud-native networks Function: It a software-implementation of a network function, which runs inside a container to deliver private network experience. Traditionally it is performed by a physical device. Cloud native networks tools make it easier to manage networking for cloud native applications.

Example: (i) Multus is the open-source project that enables Kubernetes pods to attach to multiple networks. (ii) Weavenet: It create virtual layer 2 network that connects containers on the same host or across multiple hosts.

7- Monitoring: To monitor applications, alarms of hosted applications and underlying infrastructure. Prometheus and Graphana are leading tool to capture alarms, data for monitoring and analysis.

8- Application programming interface (API): It is set of tools, definitions, and protocols to interact with applications and services. It facilitates the communication with external channel/ partners and products without building separate infrastructure interface. API can be designed as private, shared, or public.

9- Log management: With the dealt with microservice base architecture, every application is generating own logs based on their functionality. In complex architectures it is required to store and manage logs at a single place where all the information is stored to track and analyze. Elastic stack is popular log management tool. It is a distributed key-value store.

10- Tracing: Tracing tools are helping to monitor and visualize the transactions within distributed microservices base network. It facilitates with debugging features in complex distributed environment. Zipkin and Jaeger are available tools for tracing purpose.

11- Data Bus: The tools require to process the data from one services to another. Apache Kafka is an open-source distributed event streaming platform.

12- Securing communication with Certificate: Certificate is required to secure the communication between services. Typically in container based architecture all applications are running on virtual OS (Container) on the same physical machine without encryption. The certificate will help in building trusted communication between services. Google Managed SSL certificates are Domain Validation (DV) certificates.

Blockchain- Future of Telecom industry


In today’s flat world the major backbone is communication. The need for CONNECTED SOCIETY with the evolution of 5G/IOT technology has increased the data flow exponentially. This has draw a new line of business and technical challenges for Communication Service Provider (CSP) on;

(i) Secure and Trustworthy communication
(ii) Cross Border Jurisdiction process
(iii) Global fraud
(iv) Revenue leakage e.g. with loss of data
(v) Delay in multi party Settlement
(iv) Involvement of third party to ensure data integrity
(v) Real time tracking of events and Service Level Agreement

These aforesaid concerns challenged the business leaders on their existing business model and force them to think beyond to foster a new “TRULY GLOBAL” business model for operators to create new revenue stream supporting transactions in any currencies.

Here we can leverage Blockchain technology using Smart Contracts (SC). Blockchain facilitates the decentralized approach for CSP so that there will not be a single authority in between to ensure data integrity and security. 

In nutshell Blockchain technology;

  • Is a shared, replicated, permissioned ledger technology
  • Can open business networks by taking out cost, improving efficiencies and increase accessibility and revenue stream
  • Is Immutable, Data in Append mode only and can’t be altered.

Smart contracts are self-executable, verified and signed contracts encoded in programming language over blockchain network. This SC shall be self executed after fulfilling the predefined criteria of executions between the parties. Smart Contracts can be created using several popular SDK’s such as Ethereum, Hyperledger etc.

The Current Vs Blockchain business model for all types of inter operators transactions shall be;

In this above scenarios, the existing business model is “CENTRALISED” and Telecos have dependency to rely on third party (Middleman) to ensure transactions/data authenticity/integrity routed to their another partner Telecos.

It clearly shows lack of trust between partner Teleco operators and they are buying trust from third party to authenticate.

The Blockchain- Smart Contract will enable DECENTRALISED business model and both the partner telecom operators can mutually define there rules and transact in real time directly. This will create trust with partners and reduces their huge OPEX cost.

The typical service flow of Blockchain smart contract technology will be;

The current implementation challenges with Blockchain are;

  • No Industry standard for blockchain adaptation unlike ETSI
  • No Regulation Guidelines while dealing with Third Party Information
  • No Pricing standardization (Pricing guidelines)

Cloud Computing


Cloud computing is on-demand delivery option of computing resources such as servers, storage, databases, networking, software, and analytics etc. over the Internet.

The main benefits of using cloud are;

1- Scalability- Instant scale of services, underlying infrastructure and applications etc.
2- Uses based Pay- You have to pay based on application, service or infrastructure uses
3- Productivity- Easily accessibly and faster configuration
4- Reduced CAPEX and OPEX
5- Reliability

Types of cloud services.

Software as a Service (SaaS): To use the provider’s application running on the cloud infrastructure. The application can be accessible from the various client devices through a thin client interface e.g. Web browser, web based emails etc. The consumer doesn’t manage or control underlying infrastructure including network servers, middleware, OS etc.

Advantage of using SaaS

  • Instance setup/configuration of Apps.
  • Apps and data accessible from any machine over the Internet.
  • Instant scaling of application

Platform as a Service (Paas): To deploy onto the cloud infrastructure consumer created or acquire the applications created using programming languages and tools supported by the providers. The consumer doesn’t manage or control underlying infrastructure including network servers, middle-ware, OS etc. but has controlled over the deployed applications and possibly application hosting environment configurations.

Advantage of using PaaS

  • Instant and easy deployment of application
  • Reduced complexity using Middleware

Infrastructure as a Service (IaaS): To provision, processing storage, network and other fundamental computing resources where the consumer is able to deploy and run arbitrary software. This can include OS and applications. The consumer can’t control underlying physical infrastructure but has control over operating system, storage, deployed applications and possibly selected control over networking components.

Advantage of using IaaS

  • On demand self-service
  • Broad network access
  • Resource pooling
  • Measure service

 

Types of cloud deployment

  • Public cloud
  • Private cloud
  • Enterprise cloud

Network function virtualization (NFV)


NFV was introduced to reduce the number of hardware platform and create flexibility in network and IT domain. NFV aims to leverage IT standard virtualization technology to consolidate network applications into  telecommunication standard service switches and storage and to create openness towards application layer.

NFV is to create virtualization layer between the software and hardware. The decoupling of hardware and software removes challenges that operators today have in regard to dependencies of the two like upgrades, expansions, new functions  and all activities in network that impact the individual nodes and create  long lead time. With the decoupling of software and hardware all of these mismanages will be removed. Additionally to this since the hardware base is  not application dependent, it gives the operators possibility to allow other  users to utilize the network, creating a new revenue stream and important  part is all this can be managed in cloud. Meaning that cloud shall orchestrate the virtualization layer that it in turns automatically administrate the cloud resources at hand.

NFV is implementation of network functions as software only entities that run over the NFV infrastructure (NFVi).

NFV has 3 main working domains

1- Virtual network functions (VNF) – as the software implementation of network function which are capable to running over NFVi. A VNF is virtualization of network functions in a legacy non virtualized network. E.g.:  NF is 3GPP evolved packet core EPC network management, such as mobility management entities (MME), serving gateway (SGW), and Packet data network gateway (PGW), Residential gateway (RGW), dynamic host configuration protocol (DHCP) servers, firewall etc.

A VNF can be composed of multiple internal components. E.g. one VNF can be deployed over multiple virtual machines (VM) or each VM host a single component of VNF. In other cases whole VNF can be deployed on single VM also.

2- NFVi– including the diversity of physical resources and how these can be virtualized. NFVi supports the execution of VNF.

3- NFV management and orchestration– which covers orchestration and  life cycle management of physical and software resources that supports the infrastructure virtualization and life cycle management of VNF’s. Focus on all virtualization specific management tasks necessary in the NFV framework.

NFV framework.

The NFV framework enables dynamic construction and management of VNF instances and relationship between them regarding data, control, management and dependencies and other attributes.

NFV architectural framework identifies the main functional blocks and main reference point between such blocks like VNF, EMS (element management system), NFVI (including HW and virtualized resources) and virtualization layers.

NFV benefits.

Reduce CAPEX, OPEX, power consumption, time to implement the new network services, Improve ROI. Greater flexibility of scaling.

 

 

Telecom billing process


The billing process gathers all charges, prepaid, postpaid and hybrid, due for the current settlement period and creates a convergent invoice for end customers and business partners. The billing can be run flexibly, in regular mode, on-demand, immediate, and in simulation mode. It allows dynamic invoice layout including electronic formats.

Billing Key features are

  • Collect charges for a billing period
  • Definition of billing cycles
  • One-time and recurring charges
  • Billing promotions and discounts
  • Prorating of recurring charges
  • Generation of invoices, including promotion details
  • Prepaid statements
  • Multiple bills for a single contract and a single bill for multiple contracts
  • Configurable rounding strategy
  • Parallel billing processes
  • Other Credits & Charges
  • Configures and calculates taxes

Billing Modes are

1- Regular Billing

  • Based on Bill Cycle definition
  • Executed at predefined date and time
  • Impact in data base

2- On Demand Billing

  • Any time between two regular Bill Cycles
  • Generated for a single or group of Customers
  • Billed from the last billing date until the virtual start date

3- Immediate Billing

  • Started Immediately for Customers or Group of Customers
  • Covers the Last Billing Date up to the precise moment the immediate billing run was launched
  • The billing mode is performed till most recent received UDR.

Billing Purpose

1) Regular billing: The real billing where bills are    generated and all the changes reflected in the database.

2) Information billing:  bills are produced for information purposes only .no changes are reflected to the database.

3) Simulation billing: bills are generated in the simulation billing only for the testing purpose. Simulation billing is normally used when new rate plans, services or promotions have been introduced.

To execute the customer billing below information are required.

  • Definition of billing cycles and due date
  • Customer type details ( e.g Large, Retail, Enterprise accounts etc)
  • One-time and recurring charges
  • Billing promotions and discounts
  • Prorating of recurring charges
  • Bill type e.g. Multiple bills for a single contract and a single bill for multiple contracts
  • Configurable rounding strategy
  • Late fee inclusion/exclusion criteria.
  • Other credit charges and rate plan details
  • Existing customized billing scripts details
  • Other credit charges and rate plan details

 

Internet Telephony and SIP based VOIP application development on android


1)Internet telephony and SIP

Internet telephony is one of the latest emerging technology which provides the transmission of human voice over Internet channel.It provides call services at cheaper rate than normal PSTN based call. The technology establishes call and sends/receives data over existing internet network using IP protocol.SIP is the application layer protocol, a signaling protocol which is used for establishing multimedia session over IP network in the internet telephony process.The standard port for SIP is 5060.The protocol can use both UDP or TCP as underlying transport protocol. SIP is used for multimedia session establishment ,session termination like call set up and call release.The application has to create TCP/UDP socket with the SIP server for sending SIP signaling.SIP packet contains header and payload. SIP headers are formed as per RFC specification.

2)Device Network transaction

2.1)Device Registration

To use SIP services, application has to perform registration with its identity to SIP server, an application server for SIP signaling and routing packet to the external IP network. User(application) sends SIP REGISTER packet to perform Registration with the SIP server. The server may ask for user authentication through SIP unauthorized 401 and user again needs to register with proper credential response information in an encrypted form. If User credential is validated by Server, then Register acceptance request in form of 200 OK will be sent to user.The SIP server contacts HSS to get user information, user subscription and for user credential verification.

The below figure depicts the SIP transaction process that happens when User performs registration to SIP server

1

2.2)Call Establishment

Once device is registered with SIP server, it is allowed to use SIP service request like call,sms over IP channel. To make audio calls over internet ,a VOIP application has to be installed on mobile device which would use SIP protocol . Once the call session is established using SIP signaling, real time data like audio/video will be passed through medial protocol like RTP(Real time protocol).

The below figure depicts the SIP transaction process that happens between calling party, A and called party B on establishing audio call.

2

The above call transaction is defined as let’s calling party A wants to make call to called party B assuming both the parties are registered to SIP server.The calling party A sends call set up message using SIP packet INVITE to its registered SIP server.The SIP server of A sends to SIP server of B over IP network.SIP server of B delivers call set up request INVITE to called party B.The B acknowledges the request with SIP 100 trying. When called party device B starts ringing, it sends SIP 180 Ringing to calling party,A. When called party picks up and receives the call, SIP 200 OK is sent from B to A. The calling party, A sends acknowledgement for 200 Ok to called party as SIP ACK. The signaling is completed and call session is established between A and B.Now the actual audio conversion is transmitted as data using RTP .When called party B ends the call SIP BYE packet is sent to calling party. The calling part A, acknowledges the call termination with SIP 200 OK. SIP REGISTER SIP BYE,SIP 200,180 are the different kinds of SIP packet.

3)SIP based VOIP (voice over IP) client development on android.

Android 2.3 version, Gingerbread has come up with VOIP framework stack which ease developer to make VOIP application and use VOIP framework API’s.The VOIP application connects with Android SIP service which runs as a separate process.Like TelephonyManager is an interface to use phone services, similarly android provides SIPManager for an application to start SIP services and use exposed apis of SIP service like makeAudoCall(). When SIP service receives call request from application, it uses SIP signaling method first to establish call session and then actual audio data will be sent over RTP.The SIP service uses javax.sip package to create SIP headers, to send and receive SIP packets.

The steps for developing VOIP includes following points:

a)Setting up User profile and Registering Intent.

SIP manager is instantiated first as

mSIPManager = new SIManager(context)

This installation connects application with SIP services. The application first registers his identity for using sip services like audio call to sip service. A sip profile object, sp is created which includes SIP account user id,password,SIP server domain name. The user must hold account with VOIP provider. Secondly, application has to register an intent to the sip service for receiving incoming call. This intent is passed to the SIP service. When SIP service receives incoming VOIP call ,it broadcast the registered intent and register receiver in application context receives the broadcast intent.

PendingIntent pi = PendingIntent.getBroadcast(this,0,new Intent(“android.SipDemo.INCOMING_CAL”),Intent.FILL_IN_DATA);

The application uses SIPManager’s open(sp,pi) call to register sip profile and incoming call intent to SIP service. The application must define a broadcast receiver to receive the broadcast from SIP service with intent action android.SipDemo.INCOMING_CAL.This intent is broadcasted when sip service receives incoming SIP call from network.

b)Registration listener

To use SIP services, device has to register with SIP server as explained above. So application needs to set up registration listener to know its registration status with SIP server. If device is de-registered with server, it will not be able to make call. Registration is the signaling procedure that UE has to perform before making SIP audio call.

mSIPManager.setRegistrationListener(new SIPREgistrationListener(){

public void onRegistrationFailed(String localProfileUri, int errorCode,

String errorMessage) {

// TODO Auto-generated method stub

print(“sip registration is failed”);

} public void onRegistrationDone(String localProfileUri, long expiryTime) {

// TODO Auto-generated method stub

Log.d(LOG_TAG,”sip registration is done”);

} public void onRegistering(String localProfileUri) {

// TODO Auto-generated method stub

Log.d(LOG_TAG,”sip registration in progress”);

}}); });

c)Now the application is ready to make audio call using SIP manager api’s makeAdiocall passing audiolistner interface instance.

Let’s destAddr is the destination address String.

mSIPManager.makeAudioCall(mlocalProfile,(new SipProfile.Builder(destAddr)).build(), mSIPAdioListner , timeout_value);

where mSIPAudioListner is the audi listener interface which is the callback invoked when audio call is established, released.

SIPAudioCall.listner mSIPAdioListner = new SIPAudioCall.listner(){

@Override

public void onCallEstablished(SipAudioCall call) {

Log.d(LOG_TAG,”onCallEstablished”);

call.startAudio();

call.setSpeakerMode(true);

call.toggleMute();}

@Override

public void onCallEnded(SipAudioCall call) {

Log.d(LOG_TAG,”onCallEnded”); }}

Whenever SIP manager is instantiated by application, the application connects with SIP service. In makeAudioCall api call, the application creates SIP session with connected sip service and set up the audio listener.The makeAdiocall() api of SIP service is triggered with the arguments as destination and sender user profile. The SIP service process has SIPHelper class which has apis for sending SIP REGISTER,SIP INVITE,SIP 200 OK response, SIP ACK.This class uses javax.sip.header.HeaderFactory class to create SIP header from arguments user profile of sender and receiver. Once the SIP header is formed, SIPHelper sends SIP request to javax.sip.ClientTransaction class.Finally SIP packet delivered to network through established socket connection with SIP server.If you want to know the internally call flow in details, it is recommended to download VOIP framework source code from android git repo.

4)Source code :

1: SIP demo application example can be found at http://developer.android.com/resources/samples/SipDemo/index.html

2: The VOIP framework present in android source code directory is  /framework/base/voip

3: The third part application uses classes and interface present in package. /voip/java/android

4: The package used by SIP services process is  /voip/java/com/

5: Find the source code of android voip framework at  http://mirror.yongbok.net/linux/android/repository/frameworks/base/voip/

About Author

Jainendra Kumar is Android developer. He has rich experience in developing commercial Android application. He received B.E (Gold Medalist) from BIT Mesra and MS from BITS Pilani.

Andriod messaging: Radio Interface layer


Android SDK provides apis for sending sms and receiving SMS
The two primary classes as part of  android.telephony package used for developing SMS application are
1)SMSManager
2)SMSMessage

SMS Send :

SMSManager class has api sendTextMessage(String destination_Address,String service_center address,String message,
PendingIntent sentIntent,Pending deliveryIntent)

destination_Address
:  MDN no of sms receiver
Service_center_address :The service center address is retrieved from SIM.If null,sms packet will be routed to default MSC
Message :text message to send.

PendingIntent

Pending Intent (android.app.PendingIntent)
Android has provided PendingIntent class which defines an intent and the components which can handle the intent to perform specific task.
The sent pendingIntent,sendIntent which is called  from telephonic framework when sms is sent.
SMS is sent when sms packet is received by SMSC.

Delivery Intent :

The pendingIntent deliveryIntent defines an the application component which is fired when telephoy framework broadcast the delivery status of message. The SMSC forwards the message to SMS receiver .When it receives ack from sms receiver,it sends special message called Status report. This is sent only when sender has requested for delivery report.The particular field has to be set in SMS pdu packet. When telephony framework receives the status report message,it broadcast the sms delivery status.
The delivery intent is null if user has not enabled message delivery option in Message setting.

For example
SMSManager sm=sms.getDefault();
sm.sendTextMessage(” 944437890″,NULL,”hello”,si,di);

The instance of sent penidingIntent,si is obtained by
PendingIntent si = PendingIntent.getBroadcast(context, 0, new Intent(“SMS_SENT_ACTION), 0);

The above argumented context must register broadcast receiver  sentIntent :
context.registerReceiver(sentIntent,new IntentFilter(“SMS_SENT_ACTION”);

By registering broadcast receiver,the sentIntent receiver is called when sms sent event is dispatched by SMSDispacther of Telephony Framework. through si.send() call.

BroadcastReceiver sentIntent =new BroadcastReceiver(
public void OnReceive(Intent intent)
{
switch(intet.resultCode)
{
case :A\ctivity.OK :
“sms sent successfully ,move to sent folder with sent status”
case : SMSManager.RESULT_ERROR_GENERIC_FAILURE :
“sms failed ”
case :SMSManager.RESULT_ERROR_NO_SERVICW
“push the message in the sms queue database,message will be sent when network service will be available,move to outbox”
}  } );

The Application sends next message when the sent intent of previous message is arrived.Each typed message is queued in sms database.The next message from the top of the queue is taken when sent event of previous message is processed.This way messages are sent sequentially.

The delivery Intent di is obtained by
PendingIntent deliveredPI = PendingIntent.getBroadcast(context, 0, new Intent(“SMS_DELIVERED_ACTION), 0);
Like sentIntent,the context has to register broadcast receiver,which be would handled when sms application receives the delivery of the message from framework
through delivery intent
The telephony intent broadcast with the deliveryIntent’s intent and the receiver deliveryIntent is triggered.

context.registerReceiver(deliveryIntent,new IntentFilter(“SMS_DELIVERED_ACTION)
BroadcastReceiver deliveryIntent =new BroadcastReceiver(
{
public void onReceiver(Intent intent)
{
if(getResultCode==Activity.OK)
“sms delivered update the status of sms to delivered in the sent folder”
}});

SMS Framework :SMS Apis,sendtextMessage calls SMS framework classes.The main class is SMSDispatcher which handles incoming and outgoing sms transaction and interacts with application through intent.The sms framework can send sms over CS(circuit switched) or PS(packet switch) network

For CS,framework will make RIL request to RIL(radio interface layer) layer of android telephony,RIL layer sends request to MODEM.MODEM route sms packet in form of data burst message to Base station.

For PS,Framework dispatch pdu to SIP stack ,which forms SIP(session initiation protocol) packet  and send to registered SIP server. The SMS framework is part of phone process and it is initialized on bootup. SMS framework forms transport layer sms pdu from the input parameters ,destination_no,message,sent intent,delivery intent.

The pdu is formed as per 3gpp2 sms Specification for sms over CDMA channel and 3gpp spec for sms to be sent over GSM based channel.

SMS RECEIVE :

Whenever phone boots up,the smsDispatcher(part of phone process),registers itself as handler to RIL(radio interface layer)
Whenever RIL receives unsolicited sms receive command from MODEM,it calls the sms handler with NEW_SMS_RECEIVE event and
smsDispatcher post the sms receive event to SMS application. The SMS application receives the new sms intent from framework and intent data contains SMS pdu which is byte array. The application creates android.telephony.SMSMessage object from received pdu through SDK class

SMSMesssage msg=SMSMessage.creatFromPdu(pdu)
The message display to display on UI can be obtained from msg Object as

String text=msg.getDisplayMessageBody()
String origination_no = msg.getDisplayOriginatingAddress()

The application should include the required permissions android.permission.SEND_SMS and android.permission.RECEIVE_SMS in sms application’s android.manifest file.

About Author

Jainendra Kumar is Android developer. He has rich experience in developing commercial Android application. He received B.E (Gold Medalist) from BIT Mesra and M.S from BITS Pilani.

Short code


Short codes or short numbers are special telephone numbers, to address SMS and MMS messages from mobile phone or fixed phone. There are two types of short codes: dialing and messaging. Short codes are widely used for VAS such as television voting, ordering ringtones, interactive campaign etc.

Shorts codes are configured as Special numbering plan in system and there will be special tariff defined by the service provider for using short code service. Short code also differs from normal mobile range and charging pattern is also different from normal mobile charging pattern.

Charging pattern of Special number are mostly two types:

1: Normal charging

2: Reverse charging

Under Normal charging subscriber is liable to pay charges as per charging uses fixed by operator for using the service.

Eg: Suppose a SMS short code 8888 (CALLED_NUMBER) is provided by operator to activate caller tune and for using this service subscriber (CALLING_NUMBER) will be charged by amount X .In this scenario if a subscriber wants to activate caller tune on his mobile then for every SMS to this short code subscriber will pay amount X for using this service.

In Reverser Charging: CALLED_NUMBER will liable to pay if subscriber using the service.

Eg: suppose operator or CALLED_PARTY configured a short code (123456) for promotional offer (free service). If any subscriber (CALLING_PARTY) will SMS or call to this number then CALLED_PARTY will be libel to pay. In this scenario reverse charging on CALLED_PARTY will be set during rate plan configuration.

Closed User Group (CUG)


Closed User group (CUG) is a supplementary services provided by the mobile operators to mobile subscriber’s who can make and receive calls from member associated within the group. This service applicable for SMS also. There will be administrative owner who will be responsible for invoicing. Irrespective of this a CUG member can make and receive  calls to and from other networks ,other then CUG group too.

CUG Overview

Eg: Suppose a company name X ( lets say small organisation)  have N number of employees and they want to associates its employee with CUG rateplan CUGX. In this scenario all N employees have CUG rate plan other then normal rate plan. The rating of call made between all N employees will be rated with CUG rateplan CGUX. There will be one payment responsible who will be responsible to invoice.

Take an another example of Big organisation who have different hierarchy within organisation. Now the organisation want to setup different types of CUG rate plans with different access limit ( inbound and outbound limits) . Then mobile operator can provide N numbers of different CUG rate plans for as per company requirements. Now suppose a company have 2 different CUG rate plans ( eg: CUG1 and CUG2) for 2 different group types .If a mobile subscriber of CUG1 group make a call to member within the same group CUG1 then this will be IntraGroup CUG option and if Mobile subscriber of group with CUG rate plan CUG1 make a call to group with CUG rateplan CUG2 then the same will called InterGroup CUG option.

CUG rate plans are different from normal rate plans in various aspects: as

A: CUG rate plans are withing groups /organisation while normal customer rateplans are for all types of fixed lines,mobile ,specific number and International numbers.

B: CUG rate plans are for only telephony and SMS while normal rateplans are for telephony,SMS,GPRS,Blackberry.

Rating and invoicing of CUG calls:

Suppose a subscriber have normal rate plan ( RP1) and also they have CUG rate plan CUG1. Subscriber makes a calls within groups and outside groups in their billing cycle.

Suppose subscriber made N numbers of call in which X calls with Normal rate plan and Y calls with CUG rate plan. Then invoice will generate with both two rateplans.

At mediation end we segregate CUG calls with CUG Identification code ( Different billing system have different name) and send them for rating.