My Experiments on SIP SoftPhone for Android

1 min read

I wanted to build a simple SPI Softphone for Android and started digging out the possibilities. As you know Session Initiation Protocol (SIP) is a communications protocol for signalling and controlling multimedia communication sessions .Largely used in linked Firms to communicate with each other and within (normally done with desktop phone), so we tried to do a little experiment of creating an application with Android app.
sip_all
The system we were going to build contains UserAgents and SIP servers, in short the UserAgent contact with another UserAgent who is registered in the same SIP server using the server between them.
Lets see what happens normally in SIP and how things are done:
1. Registration Process
The User Agent registers with the SIP server for the first time
SIP Registration
Image courtesy: Wikipedia
First the user with his/her credentials to register with the server .
The Android codebase would look like:
[source language=”java”]
mSipManager.setRegistrationListener(mSipProfile.getUriString(), new SipRegistrationListener() {
public void onRegistering(String localProfileUri) {
updateStatus(“Registering with SIP Server…”);
}
public void onRegistrationDone(String localProfileUri, long expiryTime) {
updateStatus(“Ready”);
}
public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) {
updateStatus(“Registration failed. Please check settings.”);
}
}
[/source]
2.Calling an User
The user calls another user who is registered with the same SIP server.
Call Flow
Image courtesy: Wikipedia
The Android codebase would look like:
To make call:
[source language=”java”]
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
@Override
public void onCallEstablished(SipAudioCall call) {
call.startAudio();
call.setSpeakerMode(true);
call.toggleMute();

}
@Override
public void onCallEnded(SipAudioCall call) {
// Do something.
}
};
[/source]
To receive call:
To receive calls, a SIP application must include a subclass of BroadcastReceiver. Follow the steps in Android developer site
Thats it and you can start making calls using SIP softphone architecture.

Tools I have used :

1.Took clone from SipDemo sample app provided by Android developers community site.
2.Registered with 2 different profiles in linphone which is an open source and free SIP server.

Conclusion:

The SIP API’s of android are pretty deep and gives you good headup with SIP protocols and how to do things in a simple way. Its highly customisable and scalable to peer to peer and multi connections. Through my research in implementing SIP for mobile platforms, we also came across linphone which is another idk above Android to do the same things and pretty cool, which provides sdk for iOS also in a doable format.

Related posts:

Galen Framework – Part 2

Today, lots of automation tools are available in the market for the various testing purpose like cross browser testing, Responsive testing, load testing etc.,...
karthikeyan S
1 min read

Create Beautiful Charts in iOS using React native

Charts are getting important in our applications day by day , users now prefer diagrammatic representations that looking at a table and understanding the...
Ranjith Varma
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *