Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Klone: A Viber Mirror-Replica

No description
by

Mustapha Kamel

on 5 April 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Klone: A Viber Mirror-Replica

Acknowledgments
VoIP Technologies
Research Focus and Motivation
Introduction
SipManager is responsible for the following

Initiating the SIP session
Initiating and receiving calls
Registering and unregistering with SIP provider
Verifying session connectivity
SIP Manager
Oracle VB: Implementation
Klone: A Viber Mirror-Replica
Hassan Othman Ziko
Mostafa M. Ayman

Supervisor: Dr. Wael Abouelsaadat

Application Architecture
Android SPI API
SIPdroid Library



Client Side
SIP (Session Initiation Protocol)
Android provides libraries that includes a full SIP protocol stack which supports the implementation of an SIP client.

There are three essential classes in the SIP API library

SipManager
SipProfile
SipAudioCall
Signing In
Validation
Verification
User Extension and Contact Extension
Making and receiving calls
Application Architecture
Back End (Server Side)
Oracle Virtual Box: Background
Oracle VirtualBox
Ubuntu Server
SIP (Session Initiation Protocol)
Asterisk Server
WAMP Server
VirtualBox 4.3.6 64-bit for Windows 7
Download and Installation
Creating a VM:
Name
Distribution (Ubuntu Server 64-bit)
RAM - Hard Drive (Dynamic Allocation)
Additional Settings:
Locating the ISO file
Network: Bridged Adapter
Ready to go
SIPdroid
Ubuntu Server: Background
Session Initiation Protocol (SIP)
Asterisk Server: Background
WAMP Server: Background
Digital Ocean
The Biggest Net
PSTN:
Telephone Lines
Fiber Optic Cables
Microwave Transmission Links
Cellular Networks
Satellites
Undersea Cables
VoIP has given birth to..
Advanced Media Streaming Protocols
Desktop and Mobile Applications
Advanced Media Encoding
Superstars of VoIP
Viber
100M+
Active Users
Skype
500M+
Active Users
Research Focus and Motivation
Methodological vs Academic
"The Know How"
Exploring:
Virtualization
System Administration
Database Management
Server Administration
Communications Protocols
Audio and Image Processing
How We Replicated Viber
Features and Services
Problem:
Minimal Technical Documentation
Proprietary
Goal:
Replicate Services Separately
Tools:
Solutions available in the market
Thesis Structure
Client Side
Server Side
Cost and Feasibility
Actual Machine vs VM
Hardware Efficiency
Other solutions like VMWare
Important Check: Functionality on VM
Ubuntu Server 12.04 LTS
Essential for Asterisk
Generally; Solid, well documented and sustainable
Alternative: Centos
No GUI
Ubuntu Server: Implementation
Download and Installation
Setup: Installation Language - Country - Keyboard Layout - Machine Name - User Profile - Disk Space - Partitioning - System Updates
Manual Update
NTP Enabling
Multimedia Protocol (Voice)
Promising
Inspiration of many contemporary proprietary protocols
SIP: Capability
Addressing mechanism: Caller -> Callee
Incoming/Outgoing Sessions
Media Encoding
IP address determination
Call Management: Media Streams - Conferencing - Transferring - Holding - Voice Mail
Powerful Protocol
SIP Addresses
Composite: extension+ip address
hassan@asterisk.com instead of 01002003004
You can use any set of characters for an extension
Internet Protocol Private Branch Exchange
Open Source PBX
All features as PSTN
SIP/IAX/IAX2/MGCP/H.323
FPBX/PIAF
Originally made for Linux OS
Support for Linux
Asterisk Server: Implementation
Software Dependencies
Making directory for Asterisk
User Permissions
Creating Configuration Files
Asterisk Server: Making Calls over SIP
SIP Profile
SipProfile mainly defines the user's SIP Profile, it's also responsible for registering with the server (Asterisk).

SipProfile includes:
SIP account created from the server side.
Server domain
User's password





Continue SIP Profile

SipProfile.Builder builder = new SipProfile.Builder(username, domain);
builder.setPassword(password);
mSipProfile = builder.build();
mSipManager.setRegistrationListener(mSipProfile.getUriString(), new SipRegistrationListener() {

public void onRegistering(String localProfileUri) {
updateStatus("Registering with SIP Server...");
}


Registering with the server through SipRegisterationListener()
Every user has an Account+Dialplan
Dialplan: what happens when this extension is called
Creating accounts
1 user to 1 extension
Simple Generic Dialplan
Central DB
Intercepting a call
Asterisk Server: Configuration Files
In order to be able to receive a call we need to use intents
WHAT IS AN INTENT?
Intents
It's a facility that provides the android activity to launch another activity.
When the SIP service receives a new call, it sends out an intent with the action string provided by the application. In SipDemo, this action string is
android.SipDemo.INCOMING_CALL.
Setting the action which will be used by an intent filter when the device receives a call:

Intent intent = new Intent();
intent.setAction("android.SipDemo.INCOMING_CALL");
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, Intent.FILL_IN_DATA);
mSipManager.open(mSipProfile, pendingIntent, null);
Broadcast Receiver
Android component which allows you to register for application events. All registered receivers for an event will be notified as soon as this event happens.
Intent Filter
IntentFilter filter = new IntentFilter();

Filtering a particular action

filter.addAction("android.SipDemo.INCOMING_CALL");
callReceiver = new IncomingCallReceiver();
this.registerReceiver(callReceiver, filter);
Creating an intent filter
In
AndroidManifest.xml
, declare a
<receiver>
. In SipDemo, this is
<receiver android:name=".IncomingCallReceiver" android:label="Call Receiver"/>.
Implement the receiver, which is a subclass of
BroadcastReceiver
. In SipDemo, this is
IncomingCallReceiver
.
Initialize the local profile (SipProfile) with a pending intent that fires your receiver when someone calls the local profile.
Set up an
intent filter
that filters by the action that represents an incoming call. In SipDemo, this action is
android.SipDemo.INCOMING_CALL.
Intercepting a call II
public SipManager mSipManager = null;
...
if(mSipManager == null) {
mSipManager = SipManager.newInstance(this);
}
The function of the Intent filter is to intercept that broadcast which will then fire the IncomingCallReceiver


We'll use
intent filters
in order to be notified by a broadcast once an incoming call arrives.
IncomingCallReceiver
has to extend
BroadCastReceiver
Making a Call
In order to place a call, we need to set up a listener
SipAudioCall.Listener listener = new SipAudioCall.Listener()

During the call we want to the start transferring audio, and turn on the speaker mode.
public void onCallEstablished(SipAudioCall call) {
call.startAudio();
call.setSpeakerMode(true);
call.toggleMute();
...
}
public void onCallEnded(SipAudioCall call) {
Intent intent = new Intent(this, Dialog.class);
startActivity(intent);
}
Making a Call II
call = mSipManager.makeAudioCall(mSipProfile.getUriString(), sipAddress, listener, 30);

sipProfile = caller's sip profile
sipAddress = address of the callee
listener = sip listener
30 = timeout
SIP Profile (Registration)
To complete the registration phase, we need to set a SipRegistrationListener on the SipManager, in order to determine whether the sipProfile was successfully registered with the SIP provider (server)


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.");
}
Application Architecture
SIGN UP/IN
CONTACTS
LIST
DIALOG
API
MAKE
CALL
INSTANT
MESSAGE
(IM)
SipDroid uses the main facilities and the components of the Android library, but since it's an open-source project, it takes the whole library to an advanced level.
SipDroid mainly uses 6 codecs for audio decoding and encoding
1. G772 48, 56 and 64 kbit/s
2. PCMA 64kbps
3. PCMU 64kbps
4. speex 44 kbit/s
5. GSM 30 kbps
6. BV16 16 kb/s - 32 kb/s

Contacting the API
Transactions between the server and the application are basically carried out through http requests (POST and GET)
POST: used if we want to modify something in the server
e.g
Insert data in the database table

GET: used if we want to retrieve information from the server,
e.g
querying the database for instance.


POST request
In order to save the phone number with which the user signed up
we need to insert said phone number in the database table.

First we need to create an httpClient in order to perform such a request
httpclient = new DefaultHttpClient();

Second, specify the address of the API service that the application will send the data to
httppost = new HttpPost("http://localhost/ziko/index.php");

POST request II
In order to send the data we need to encapsulate it in a Name Value Pair arraylist
nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("Phone Number", phoneNo));

httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

response = httpclient.execute(httppost);


Response will have the value of the server response after executing the httppost.

If the response's status line is 200, then that means the post was successful.

GET request
URL of the API Service
String getURL = "http://localhost/ziko/CheckNumber.php?number="+number;

Initializing a get request
HttpGet get = new HttpGet(getURL);


HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
The server checks the number one by one and sends a response very much like the post response, except here it either sends true or false, true being that the server was successful in finding the phone number the application just sent in its database table.


sip.conf: where all the SIP accounts are created
extensions.conf: where all the dial plans are defined
Windows
Apache
mySQL
PHP
Creating and managing DB
phpAdmin
WAMP Server: Implementation
Download and setup
Logging in (phpAdmin)
Create DB
Write php scripts
Database Design
androidlogin table
users table
Messages table

PHP scripts
androidlogin table
index.php
GetExten.php
users table
CreateUser.php
checkNumber.php
GetUID.php
Message Table
SendMessage.php
GetMessage.php

Easier acces to asterisk server
Static IP that can be addressed from network
Solid solution for server virtualization
Uses SSH client to connect to the linux based machine
In order to access our server we type
ssh root@'static ip'
Conclusion
Recap:
Feasible replication
Open source alternatives in the market
Setting up the pbx is the first and biggest step in any voip (Many free sip clients are available in the market)

Future Work
Additional features: Viber out
Supported by asterisk
PIAF instead of manual setup
Major security measures

The Promise
Massive increase in VoIP users
Migration from traditional telephony to VoIP
A matter of
infrastructure
?

Infrastructure
Different high level operations
Same low level infrastructure
A matter of
Market
?

Market research
Saturated mobile telecommunications market
Growing mobile data market
Adaptation challenges
Yet limited and expensive mobile internet provision
Result: revolutionary change

Revolution
Tremendous demand vs hesitant supply
Closing mobile telecommunications market
Rise of VoIP
Less providers
VoIP careers
Full transcript