You are on page 1of 49

A REPORT

ON

WEBRTC (CHATB)
&
SMS GATEWAY
By
Samish Bedi
(2012B3A7735P)

AT

Homi Bhabha Centre for Science Education,


Tata Institute of Fundamental Research
A Practice School-I station of

BIRLA INSTITUTE OF TECHNOLOGY &


SCIENCE, PILANI
June 2014

A REPORT
ON

WEBRTC (CHATB)
&
SMS GATEWAY
By
Samish Bedi

2012B3A7735P

M.Sc (Hons.) Economics &


B.E. (Hons.) Computer
Science

Prepared in partial fulfillment of


the
Practice School-I
Course

AT

Homi Bhabha Centre for Science Education,


Tata Institute of Fundamental Research
A Practice School-I station of

BIRLA INSTITUTE OF TECHNOLOGY &


SCIENCE, PILANI
June 2014

ACKNOWLEDGEMENT
In todays world, any academic pursuit of a team requires contribution from various individuals.
We would like to thank our PS division at BITS-Pilani for providing us with the opportunity to
extend our horizons of knowledge by working for an organization of such stature.
I would also like to thank Prof. Jayashree Ramadas, the Director of HBCSE,TIFR for giving us the
opportunity to work in the organization, without her permission we would never have been able to
get the experience of such a great technical and office culture.
I am really thankful to my Supervisor, Dr. Nagarjuna G., for his invaluable guidance and
assistance, without which the progress of the task would have been impossible. I also thank him
for giving this opportunity to explore the programming and computer science world and realize
the sheer scope of open source softwares not only in Metastudio but as a viable alternative to
proprietary paid softwares.
My heart-felt thanks also go to my PS instructor, Dr. Bibhas R. Sarkar, whose continued support
and enthusiasm always kept my spirits up and kept me calm.
I would also like to thank Akshay Rao Hoshing, Student Co-Instructor, for motivating me to
pursue the knowledge contained within the premises of HBCSE with an open mind and giving me
impetus to look for it in the right places.
In the present report I have talked about the skills used, present progress and future scope of
development of the projects Integration of Chatb and Development of SMS gateway for
development of Metastudio being carried out in the gnowledge lab of HBCSE,TIFR.
I am also thankful to the Mentors and Research assistants especially Sunny Sir, Avadoot Sir Kedar
Sir and Johnson Chetty Sir working in gnowledge lab on development of various features of
metastudio, for welcoming me in the lab and for providing necessary clarifications whenever I was
in doubt.
In the end, I am also indebted to my friends in PS; Hemant Arora, my senior from Hyderabad
Campus and my project partner Ram Karnani, who shared their valuable thoughts and ideas with
me.

1|Page

BIRLA INSTITUTE OF TEHNOLOGY AND SCIENCE


PILANI (RAJASTHAN)
Practice School Division
Station: Homi Bhabha Centre for Science Education, TIFR
Centre: Mumbai
Duration: 56 Days
Date of Start: 23-05-2014
Date of Submission: 17-07-2014
Title of the Project:

INTEGRATION OF CHATB WITH METASTUDIO


& DEVELOPMENT OF SMS GATEWAY

I.D. NO./Name/ Discipline


of the student:

2012B3A7735P |
SAMISH BEDI |
M.Sc (Hons.) Economics and B.E.(Hons.) Computer
Science

Name and Designation


of the Expert:

Dr. Nagarjuna G.
Developer gnowsys, glab incharge,HBCSE
Ph.D. in Philosophy of Science, IIT Kanpur.
M.Sc. in Biology, Delhi University
M.A. in Philosophy, Delhi University

Name of the PS Faculty:

Dr. Bhibhas Ranjan Sarakar, Instructor


Mr. Akshay Rao Hoshing, Student Coordinator

Key Words:

HBCSE, TIFR, Gnowledge lab, GNU, Ubuntu,Linux,


Open source, Python, Django, Mongodb, HTML5,
JavaScript, jQuery, CSS, AJAX, WebRTC, SMS
Gateway, Chatb.
Web Real Time Communication and SMS Gateway

Project Areas:

Entire project is based on open source technologies. Project is based on the metastudio
environment. The areas of the project are as follows:
Website development
Frontend:
HTML, CSS, Javascript, AJAX, jQuery
Backend:
Django, Python
Database Handling
Django-mongokit, Mongokit, MongoDB
Gateway Backend
Kannel backend with RapidSMS framework
2|Page

Abstract:
Metastudio as a result of the co-ordinated operation of numerous applications and
features is being developed on various specific aspects to facilitate open source and free
access to online education. Thus, a proper mechanism is needed to deal with the
development various softwares and technologies. This is what the Gnowledge lab of
HBCSE works for. The underlying principle of the metastudio website is semantic
computing. It aims at forging a knowledge graph with the help of the users themselves.
This graph in its most developed stage would be self sufficient to be used as a self-teaching
tool by a user.
This report gives a basic overview of the projects-Integration of Chatb with metastudio
and development of SMS gateway for metastuido, and the various technologies that work
behind the scenes. The project is divided in two phases. The former phase dealt with
Integrating Chatb with Metastudio .This part of the project has been successfully
implemented. It included running Chatb and designing a backend and front end interface
for users to have private as well as group meetings. We have implemented the features to
conduct on the spt as well as scheduled meetings. Second phase is developing and
integrating a reliable and efficient SMS gateway to facilitate metastudio users the access to
portal through mobile phones. This is a big ongoing project. Till now a major portion of
basic backend of SMS gateway for metastudio has been developed with many features
still in progress.

Samish Bedi
Signature of student

Signature of PS Faculty

Date: 17/07/2014

Date: 17/07/2014
3|Page

TABLE OF CONTENTS
ACKOWLEDGMENTS -----------------------------------------------------1
ABSTRACT ----------------------------------------------------------------- 3
1.Introduction ------------------------------------------------------------------------------7
1.1 Motivation-------------------------------------------------------------------------------7
1.2 Homi Bhabha Centre for Science Education----------------------------------------7
1.3 Metastudio(gstudio)--------------------------------------------------------------------8
2. Projects------------------------------------------------------------------------------------9
2.1 Integration of WebRTC(Chatb) with Metastudio ------------------------------9
2.2 Developing an SMS gateway---------------------------------------------------------9
2.3 Objectives--------------------------------------------------------------------------------9
3. Prerequisites-------------------------------------------------------------------------------11
3.1 Python-------------------------------------------------------------------------------11
3.2 Django-----------------------------------------------------------------------------------11
3.3 GStudio----------------------------------------------------------------------------------11
3.4 HTML5----------------------------------------------------------------------------------11
3.5 Ubuntu-----------------------------------------------------------------------------------11
3.6 Mongodb--------------------------------------------------------------------------------12
3.7 RapidSMS-------------------------------------------------------------------------------12
3.8 Kannel Backend------------------------------------------------------------------------12
4. Integration of Chatb with Metastudio--------------------------------------------------13
4.1 Design of WebRTC--------------------------------------------------------------------13
4.2 Project Outline-------------------------------------------------------------------------14
4.3 User Interface--------------------------------------------------------------------------22
4.4 Scope of the project-----------------------------------------------------------------27
5. Development of SMS Gateway---------------------------------------------------------28
5.1 Functioning of the SMS gateway----------------------------------------------------29
5.2 RapidSMS at glance-------------------------------------------------------------------30
5.3 Installing RapidSMS-------------------------------------------------------------------31
5.4 Starting RapidSMS with gstudio environment---------------------------------31
5.5 Application Structure------------------------------------------------------------------32
5.6 Message Processing---------------------------------------------------------------------32
5.7 RapidSMS Backends--------------------------------------------------------------34
5.8 Kannel Backend-------------------------------------------------------------------34
4|Page

5.8.1 Installing Kannel---------------------------------34


5.8.2 Setting up fake SMSC---------------------------34
5.8.3 Configuring the Gateway--------------------------35
5.8.4 Adding Backend for Fake SMSC--------------38
5.8.5 Adding GSM Modem-------------------------------40
5.8.6 Adding Backend for GSM Modem------------40
5.8.7 Deliver Report-------------------------------------41
5.9 Benefits of the project---------------------------------------------------------------42
5.8 Scope of the project------------------------------------------------------------------42
6. Conclusion----------------------------------------------------------------------------------------43
7. References----------------------------------------------------------------------------------------44
8. Glossary-------------------------------------------------------------------------------------------46

5|Page

TABLE OF FIGURES
Figure 1: Node types supported by gstudio-------------------------------------------8
Figure 2: Metastudio view after inclusion of Meeting app----------------------22
Figure 3:Meeting app interface--------------------------------------------------------23
Figure 4: New Meeting form view---------------------------------------------------24
Figure 5: Meeting details--------------------------------------------------------------25
Figure 6 : Meeting app view after scheduling a meet------------------------------25
Figure 7 : Tab view for instantaneous meet----------------------------------------26
Figure 8 : Basic model of a gateway------------------------------------------------28
Figure 9 : Basic prototype of SMS gateway----------------------------------------29
Figure 10 : RapidSMS gateway------------------------------------------------------30

6|Page

1. INTRODUCTION
The report starts with the brief description of the organization i.e. my P.S. station and
then proceeds by giving by deciding about the framework on which Metastudio works
and further the main concepts relating to project would be discussed.

1.1

Motivation

The main motive of our Chatb project is to enable quick, efficient and user friendly
communication between members of a group within metastudio. The major source of
inspiration for our project is Textb project done by our seniors, Hemant Arora and
Ruppesh Nalway last year. Nagarjuna Sir wanted a platform to conduct important
meets with fellow colleagues and students in distant places with ease and without the
use of proprietary softwares such as hangouts. Moreover the process had to be
integrated with gStudio framework and Metastudio user-interface. So with the help of
chatb and gstudio framework we introduced chatting and video conferencing features
into Metastudio.
The major motive for development of the SMS gateway is to provide potential users
access to metastudio especially to the undergraduate students who are taking the
digital literacy course and have never created mail accounts but have cell phones.
The earliest feature we ought to introduce is to make a user register at gstudio
(metastudio) without an email account by enabling him/her to fill in registration form
with his mobile number instead of email or both simultaneously, then a confirmation
code will reach the user through SMS or email depending on the option enabling
him/her to register using the code.
Thus, our project is motivated by the aim to provide an ease of access to
communicate and introduction of social networking platform on Metastudio.

1.2

Homi Bhabha Centre for Science Education(TIFR)

Homi Bhabha Centre for Science Education (HBCSE) is a National Centre of


the Tata Institute of Fundamental Research(TIFR), Mumbai, India. The broad goals
of the Centre are to promote equity and excellence in science and mathematics
education from primary school to undergraduate college level, and encourage the
growth of scientific literacy in the country.
Activities:
The organization carries out a wide spectrum of inter-related activities, which may be
viewed under three broad categories:
o Research and Development
o Teacher Education and Science Popularisation
o Olympiads, NIUS and other Students' Nurture Programmes.
Three decades after its inception, HBCSE has emerged as the premier institution in
the country for research and development in science, technology and mathematics

7|Page

education. It is also India's nodal centre for Olympiad programmes in Mathematics,


Physics, Chemistry, Biology and Astronomy.

1.3

Metastudio(gStudio)

Metastudio(gStudio) provides a way to create various types of groups allowing the


users to work in collaboration with each other.
In order to provide the individual views to the users for the single resource, revision
control system has been implemented to store the history of the document which is
used to show the specific user related documents history. This is maintained for all
the nodes, which helps to gain the information about the modification made to the
Nodes.
All the resources stored are considered as node. Node means point of information
which could have the previous related information and further information. Since this
a hierarchal structure MongoDB is used as it stores the information in the form of
document in the hierarchal format.
Metastudio works on Node Description Framework. There are two base classes called
Node and Triple. The project follows Object Oriented Infrastructure and hence any
class extends either Node or Triple class. Node class is used when information about
an object is to be stored. Triple class is used when information connecting two objects
is to be stored.

Figure 1: Node types supported by gstudio


The primary use of gStudio in our project is to:
i.
Create a GSystemtype Node named Meeting.
ii. Develop the interface of Meeting App by extending base.html file of
gnowsys_ndf.ndf.templates.
iii. Generate an ObjectId which is appended to customized url generated to
conduct meets using Meeting App of gStudio.
iv.
Store the data for scheduled meetings in mongodb database.
v.
Integrate gateway to send and receive messages.

8|Page

2. PROJECTS:
2.1

Integration of WebRTC(Chatb) with Metastudio

Our First project is the integration of chatb with metastudio portal.


The basic framework for the integration of chatb with metastudio stands on the
WebRTC framework. It is acronym for Web Real-Time Communication and is an
API definition that supports browser-to-browser applications for video calling, video
chat, text messaging and P2P file sharing without plugins. It is drafted by World
Wide Web Consortium(W3C) using javascript APIs and HTML5 and is a free, open
source project. The WebRTC initiative is heavily supported by internet giants like
Google, Mozilla and Opera.
WebRTC is the major working platform for Chatb which is a light weight webRTC
videoconferencing service. It works in an Etherpad-like fashion(share URLs to give
access). It is simple and efficient alternative to hangout for meeting that don't require
screen sharing.It is fully open source and develpoed by Jan Gerber. Source code of
chatb can be found at r-w-x.org.

2.2

Developing an SMS gateway

The second project we have undertaken is the development of an SMS gateway for
metastudio.
SMS gateway allows a computer to send or receive Short Message Service (SMS)
transmissions to or from a telecommunications network. It typically sits between the
end user who needs to send/receive SMS and a mobile network's SMSC. We have
used the basic framework of RapidSMS for the SMS services. RapidSMS is a free
and open-source framework for rapidly building mobile services for scale. It is built
with Python and Django and is designed for building robust, highly customized
mobile services with web-based dashboards. It also provides a flexible platform and
modular components for large-scale data collection, managing complex workflows,
and automating data analysis.

2.3 Objectives
The major objectives of the work are:
1. Integration of Chatb portal with metastudio as an APP for metastudio members to
conduct P2P private as well as group meetings. It includes running Chatb on our
local servers and designing a backend and front end interface for users to have
private as well as group meetings.
2. A platform to conduct important meets with fellow colleagues and students in
distant places with ease and without the use of proprietary softwares such as
hangouts. Moreover the process is integrated with gStudio framework and
Metastudio user-interface.
9|Page

3. Developing an SMS gateway for metastudio, providing members with accessibilty


to portal without using internet connection with the use of cell-phones.
4. This project would provide potential users access to metastudio especially, the
undergraduate students who are taking the digital literacy course. The user would
be able to register at gstudio (metastudio) without an email account through
his/her mobile number instead of email or both simultaneously.

10 | P a g e

3. PREREQUISITES:
The requirements for the project include knowledge and technical know-how of
following:

3.1

Python

Python is a widely used general-purpose, high-level programming language. Its


design philosophy emphasizes code readability, and its syntax allows programmers to
express concepts in fewer lines of code than would be possible in languages such as
C. The language provides constructs intended to enable clear programs on both a
small and large scale.Python supports multiple programming paradigms, including
object-oriented, imperative and functional programming or procedural styles. It
features a dynamic type system and automatic memory management and has a large
and comprehensive standard library

3.2

Django

Django is a free and open source web application framework, written in Python,
which follows the modelviewcontroller architectural pattern. It is maintained by the
Django Software Foundation (DSF), an independent organization established as a
501(c) non-profit.
Django's primary goal is to ease the creation of complex, database-driven websites.
Django emphasizes reusability and "pluggability" of components, rapid development,
and the principle of don't repeat yourself. Python is used throughout, even for
settings, files, and data models. Django also provides an optional administrative
create, read, update and delete interface that is generated dynamically through
introspection and configured via admin models.

3.3

GStudio

Gstudio is a node description framework (NDF) to create knowledge networks.


Gnowsys-studio is being recreated with mongodb as storage. The latest scaled up
version of gstudio with support for multiple projects is being used for the several
OER and open courseware projects.

3.4

HTML5

HTML5 is a core technology markup language of the Internet used for structuring and
presenting content for the World Wide Web. HTML5 is a core technology markup
language of the Internet used for structuring and presenting content for the World
Wide Web.

3.5

Ubuntu:

Ubuntu is a Debian-based Linux operating system, with Unity as its default desktop
environment (GNOME was the previous desktop environment). It is based on free
software and named after the Southern African philosophy of ubuntu (literally,
"human-ness"), which often is translated as "humanity towards others" or "the belief
in a universal bond of sharing that connects all humanity. Ubuntu is composed of
many software packages, the majority of which are free software. Free software gives
11 | P a g e

users the freedom to study, adapt/modify, and distribute it. Ubuntu can also run
proprietary software. Ubuntu Desktop is built around Unity, a graphical desktop
environment. According to some metrics, Ubuntu is the most popular desktop Linux
distribution

3.6

Mongodb:
MongoDB is a cross-platform document-oriented database. Classified as a NoSQL
database, MongoDB eschews the traditional table-based relational database structure
in favor of JSON-like documents with dynamic schemas (MongoDB calls the format
BSON), making the integration of data in certain types of applications easier and
faster. MongoDB is free and open-source software. MongoDB is the most popular
NoSQL database system.
3.7

RapidSMS:

RapidSMS is a web framework based on the Django web framework which extends
the logic and capabilities of Django to communicate with SMS messages. Initial
development was done by UNICEF's Innovation Unit for use in mobile data
collection and polls. A side effect of the work was pygsm, a Python library for
interacting with GSM modems, including cell phones which handle the Hayes
command set.

3.8

Kannel Backend:

Kannel is a free and open source SMS gateway that can be configured for use with
RapidSMS. It is possible to configure Kannel to connect directly to USB or serial
GSM modems as well as third party HTTP or SMPP gateways. Kannel is also an
open source WAP gateway. It attempts to provide this essential part of the WAP
infrastructure freely to everyone so that the market potential for WAP services, both
from wireless operators and specialized service providers, will be realized as
efficiently as possible.
Kannel works as an SMS gateway for GSM networks. Almost all GSM phones can
send and receive SMS messages, so this is a way to serve many more clients than just
those using a new WAP phone.In addition, it also operates as Push Proxy Gateway ,
or PPG, making possible for content servers to send data to the phones.

12 | P a g e

4. INTEGRATION OF CHATB WITH METASTUDIO:


The successful integration of chatb in gstudio using meeting app node has been done. The
following principles, procedures and steps are used for the purpose of completion of the
project:

4.1

Design of WebRTC

Major components of WebRTC include:

getUserMedia,
which allows a web browser to access the camera and microphone and to capture
media. Prompts the user for permission to use a media device such as a camera or
microphone. If the user provides permission, the successCallback is invoked on
the calling application with a LocalMediaStream object as its argument.

RTCPeerConnection,
which sets up audio/video calls. Basic RTCPeerConnection usage involves
negotiating a connection between your local machine and a remote one by
generating Session Description Protocol to exchange between the two. i.e. The
caller sends an offer. The callee responds with an answer. Both parties, the caller
and the callee, need to set up their own PeerConnection objects initially.

RTCDataChannels,
which allow browsers to share data via peer-to-peer. The Basic code for Data
Channels is:
var pc = new RTCPeerConnection();
var dc = pc.createDataChannel("my channel");
dc.onmessage = function (event) {
console.log("received: " + event.data);
};
dc.onopen = function () {
console.log("datachannel open");
};
dc.onclose = function (
console.log("datachannel close");};

13 | P a g e

4.2

Project Outline

This section of the report includes the various necessary procedures followed and
features introduced during the course of the project work:
I.

We have created a Meeting App Node of the GSystemType by using djangoframework in GStudio. In the terminal, following commands were used by to
create this GSystemType.
o
o
o
o
o
o
o

II.

from gnowsys_ndf.ndf.models import *


collection = get_database()[Node.collection_name]
node = collection.GSystemType()
c
Gapp = collection.Node.one({_type : MetaType , name : GAPP})
node.name = u Meeting
node.member_of .append(Gapp._id)
node.created_by = int(1)

We have also integrated video and text chat features on Metastudio using chatb
servers. We have used an iframe to connect to chatb servers and disply the video
and text chat options.
A card is created which contains the Start Meeting button on the click of which
chatb server is connected and video and text chat facility provided by the chatb is
displayed in the iframe.
The code for above mentioned operation is:
<div class="content" id="panel2-2">
<br/>
<br/>
<div class="create card">
<div class="chat">
<br/>
c
<a class="button medium"
href="https://chatb.org/#{{meetingid}}" target="Chatb">
<span class="start">&nbsp;&nbsp;Start Meeting</span>
</a>
</div>
</div>
And the code for creating thr iframe is:
<iframe src="" name="Chatb" style="position:relative"
id="ifrm"
c
height="450em" width="100%" frameborder="1"> </iframe>

14 | P a g e

III.

We have introduced an option to conduct instantaneous on-the-spot meeting


between online members of a particular group. The coordinator can look for
online members and send them request to join the meet.
Recursive ajax call have been included in the code which after every 10 seconds
fetches the list of members who are hitting continuously on that particular page by
transferring the control onto get_online_users method defined in the
meetings.py file, stores this list in cache memory and display it to coordinator
of the meeting.
(document).ready(function(){
var timer,delay = 1000*10;
timer = setInterval(function(){
$.ajax({
url:"{% url 'get_online_users' group_id %}",
dataType:'json',
success: function(data){
var aa= data;
var prev=[];
k=aa.length;
The code in meeting.py containing the method get_online_users have
been coded as follows:
def get_online_users(request, group_id):
"""Json of online users, useful for refreshing a online users list via an ajax call or
something"""
online_users = cache.get(CACHE_USERS)
#print "hey \n"
#print json.dumps(online_users, default=encode_json), "\n\n"
#a = json.dumps(online_users, default=encode_json)
#print type(a)
return HttpResponse(simplejson.dumps(online_users,
default=encode_json))
Now this code displays the fetched list of online users into a table format in a
HTML division with the id=ifrm.
var str = "<table>";
str+="<th>Online</th>"
for (i=0; i<k; i++) {

// for adding list of online


member in html template

if (Number(aa[i].status) ==1) {
str += "<tr><td>" + aa[i].user.username + "</td><td><img
src='/static/ndf/images/dot.jpg'
width=30em></td><td><input
type='checkbox' name='invite' id='"+ aa[i].user.username +
15 | P a g e

"'value='invite'>Invite</td></tr>";
var nam = "#" + aa[i].user.username;
prev.push($(nam).prop('checked'));
}
}
str += "</table>"
$("#res").html(str)
for (i=0;i<k;i++){
var nam = "#" + aa[i].user.username;
if (prev[i]==true){
$(nam).prop('checked',true);
}
}
}
});
}, delay);
});

Now the following code checks the Boolean value of the checkbox besides the
list of online users table and send invites to them using the function
invite_meeting in meeting.py file.
var aa ={{online_users|safe}}
k=aa.length
for (i=0;i<k;i++){
var usr = aa[i].user.username;
var nam1 = "#" + usr;
$(nam1).click(function(){
aaa = nam1;
$.ajax({
url:"{% url 'invite_meeting' group_sid meetingid
%}",
dataType:'json',
data : { "usr": usr},
success: function(data){
}
});
});
}
$("#node_search_form").parent().hide();
16 | P a g e

IV.

We have also introduced an option to schedule meeting on a specific date and


time between any number of registered members of a metastudio group. The
meeting coordinator enters the details of the meeting, giving information
regarding the agenda of meeting etc. and is allowed send invites to either that
particular group members or some specific individuals. This information is saved
in NOSql database and at the same time, email notifications are sent to the
invitees containing the details for the meeting. The code for this part of HTML
file looks like this:
<dd class="active"><a href="#panel2-1"><i class="fi-eye"></i> All Meeting
{% if MEETING_inst.count %}({{ MEETING_inst.count }}){% endif
%}</a></dd>
<dd class=""><a href="#panel2-2"><i class="fi-eye"></i> Start
Meeting</a></dd>
</dl>
</header>
<div class="tabs-content">
<div class="content active" id="panel2-1">
{% if searching and MEETING_inst.count > 0 %}
<div class="row">
<div class="small-12 columns end">
<p>Search Results: <span class="label success round">Found
{{MEETING_inst.count}}
{{title|lower}}{{MEETING_inst.count|pluralize}}.</span></p>
</div>
</div>
{% elif searching and MEETING_inst.count == 0 %}
<div class="row">
<div class="small-12 columns">
<p>Search Results: <span class="label alert">No
{{title|lower}}{{MEETING_inst.count|pluralize}} matched your search
criteria!!!</span></p>
</div>
</div>
17 | P a g e

{% endif %}
<ul class="small-block-grid-1 medium-block-grid-2 large-block-grid-4">
{% autopaginate MEETING_inst 23 %}
{% for node in MEETING_inst %}
{% get_version_of_module node.pk as version %}
<li class="card">
<div class="course">
<header>
<div class="label-list">
{% for tag in node.tags|slice:":3" %}
<a href="{% url 'tag_info' groupid tag %}"><span
class="label">{{tag}}</span></a>
{% endfor %}
</div>
<div class="th"><img src="/static/ndf/scss/metastudio/logo.svg"></div>
<h4>{{ node.name|truncatechars:20 }} <font color =
"red"><b>Ver.</b>{{version}}</font></h4>
<div>
<small class="subheader">{{ node.member_of_names_list|join:', ' }}
created {{node.created_at|timesince}} ago
<br/>
by <span href="#" class="user" datagnow="">{{node.user_details_dict.created_by}}</span>
</small>
</div>
</header>
<p>{{ node.html_content|default_if_none:"Add some
description."|safe|striptags|truncatechars:75 }}</p>
<a class="small button expand" href="{% url 'meeting_details'
group_name_tag node %}">Detail</a>
18 | P a g e

{% get_user_object node.created_by as user_obj %}


{% ifequal user_obj.username user.username %}
<a class="button alert tiny" href="{% url 'delete_meeting' group_name node
%}?next={{request.path}}">Delete</a>
{% endifequal %}
</div>
</li>
{% empty %}
{% if not searching %}
<div class="row">
<div class="small-12 columns">
<h5>This group doesn't have any meeting. <b>Be the first to create a
Meeting!</b></h5>
</div>
</div>
{% endif %}
{% endfor %}
{% paginate %}
</ul>
</div>
The meeting.py file contains specific methods/functions pertaining to this
template code. This code can be seen here.
V.

We have installed an API, django-online-status to display the list of online


members of metastudio. This API makes use of the cache to display the list of
users. It fetches the list of users who requests/hits on a particular page and
provides the coordinator of the meeting with this list of online members.
The requirements.txt file have been updated with the name of this package
written in it.
The steps to install the package are:
In the terminal, activate the virtual environment of gstdio and take the following
steps.
19 | P a g e

pip install django_online_status


Go in the urls.py: file of lib/online_status/ and change the first line of as
-

from django.cong.defaults.urls import patterns, urls to

+ from django.cong.urls import *

VI.

We have introduced the feature of e-mail based notification in which the chat url
generated by the OBJECTID() of the meeting coordinator would be passed on to
the other online/scheduled meeting users through an e-mail.
The code in the meeting.py file helps us to send this notification. The
notification app has been used for this purpose. The key function included in the
meeting.py file for using this app is set_notif_val.The code looks like this:
def invite_meeting(request, group_id, meetingid):
try:
colg=col_Group.Group.one({'_id':ObjectId(group_id)})
groupname=colg.name
recipient = request.GET.get("usr","")
recipient = unicodedata.normalize('NFKD',
recipient).encode('ascii','ignore')
sender=request.user
sending_user=User.objects.get(username=sender).id
activ="invitation to join in meeting"
url_of_meeting = "http://" + str(sitename) + "/" + group_id + "/meeting/"
+ meetingid
msg="'This is to inform you that " + str(sender) + " has invited you to the
meeting of " +str(groupname)+" . Please click here " + url_of_meeting +"'"
ret=""
bx=User.objects.get(username=recipient)
ret = set_notif_val(request,group_id,msg,activ,bx)
if bx.id not in colg.author_set:
colg.author_set.append(bx.id)
colg.save()
if ret :
return HttpResponse("success")
else:
return HttpResponse("failure")
except Exception as e:
print str(e)
return HttpResponse(str(e))

20 | P a g e

VII.

We have also created HTML templates for Meeting App using gstudio source
code. This template includes the following essential parts :
The tab class has been included in the code which provides the user an
option to choose between the 2 tabs namely All Meeting-which displays the
list of all the meetings scheduled by the user with an option to look for the
details regarding the a specific meeting and delete the data regarding that
particular meeting. The second tab Start Meeting provides user with an
option to have instantaneous meeting with personnel of the group by sending
them invites using the notification app containing the details to join the meet.
The code for this tab class looks as specified below:
<header class="row">
<dl class="tabs" data-tab>
<dd class="active"><a href="#panel2-1"><i class="fi-eye"></i> All
Meeting {% if MEETING_inst.count %}({{ MEETING_inst.count }}){% endif
%}</a></dd>
<dd class=""><a href="#panel2-2"><i class="fi-eye"></i> Start
Meeting</a></dd>
</dl>
</header>

Another class namely active has been included in the template which tells
us which specific tab out of the two is active at a particular point of time. We
have set the default active tab as the All Meeting tab to display the user his
scheduled meetings.
This class has been explained in the above mentioned code.

A script has been included to resize the size of iframe in accordance with the
users screen size and resolution. This script gets the height of the window and
makes the iframe height as the (0.9*height) of the screen.
<script>
$(document).ready(function(){
var size = $(window).height();
$("#ifrm").css("height",0.9*size);
});
$(window).resize(function(){
var size = $(window).height();
// alert(size);
$("#ifrm").css("height",0.9*size);
});
</script>
21 | P a g e

4.3

The list of online members is also displayed using a javascript in which a


variable stores the different html commands and the included data values by
appending them into a list.This list is then sent to the div defines in the body
of the html file and then executed.

Also, one javascript have been included to check the Boolean value of the
checkbox included in the Start Meeting tab, if the value is true-it signifies
that this particular user have been sent the invitation to join the meeting and
this script helps us retain its Boolean value even after the ajax call but if the
value is false, this means that the user have not been invited for the meeting
and new false Boolean value is assigned to this checkbox after each ajax call.

User Interface
i) The basic outlook of the the metastudio portal after the inclusion of Meeting
app looks like this:

Figure 2: Metastudio view after inclusion of Meeting app

22 | P a g e

ii) The click on the Meeting app displays the meeting.html page which contains
the two tabs as shown in the figure. The default tab have been set to All
Meeting which contain the list of scheduled meetings of the user but since we
have not entered any data yet, it is not displaying any meeting. It also includes a
card New Meeting on whose click the user can schedule a meeting. The
interface looks like this:

Figure 3: Meeting app interface


iii) The New Meeting card helps the user to schedule a meeting and on the click
over this card, the form appears as displayed in the below figure asking for the
details regarding the meeting and an option of Invite members which contains
the list of people who are the part of that particular group and checkbox to send
them invites.

23 | P a g e

Figure 4: New meeting form view

iv) Final click on the save button stores the data regarding the meeting in the
mongodb database and the final page displaying the details of that particular
meeting appears as shown below.

24 | P a g e

Figure 5: Meeting details


v) Now we look into the second tab which appears in the meeting.html file and

click on this particular tab.The interface which appears is:

Figure 6: Meeting app view after scheduling a meet


25 | P a g e

vi) This tab shows the coordinator of the meeting with the list of online members,

checkbox to send them invites and a card Start Meeting to start the meeting.

Figure 7: Tab view for instantaneous meeting between online members


vii) The click on the Start Meeting card activates the iframe, generate an ObjectId()

from the mongodb database, append this id to customize the url for the meeting
and directs the user to chatb.org servers.

26 | P a g e

4.4

Scope of the project

1) Use of WebRTC:
We have used the concept of WebRTC to develop this application.
Our project would enable the users of metastudio to interact with each other through
audio and video chat..
This real time communication mechanism have a vast scope in future as it promotes
peer-to-peer communication/sharing on a single browser click.
2) Option of Desktop Sharing:
We have added the features for having a scheduled meeting or on-the-spot meeting.
Currently, we are using the webcam for video transfer. In future, an option for screen
sharing/desktop sharing can be added in this application.
The option of desktop sharing would promote effective and efficient learning
mechanism between teachers and students.
It would eliminate the current problem of maintaining synchronization between the
two ends while teaching or delivering a lecture, for instance, the problem of
transferring the slides for delivering a lecture.
3) Running the App on our servers:
Currently, we are using the chatb.org servers for organizing our meetings but in
future, our own subdomain can be developed and control can be passed onto our
servers for organizing this meetings.

27 | P a g e

5. DEVELOPMENT OF SMS GATEWAY FOR


METASTUDIO:
An SMS gateway allows a computer to send or receive Short Message Service (SMS)
transmissions to or from a telecommunications network. Most messages are eventually
routed into the mobile phone networks. Many SMS gateways support media conversion
from email and other formats.
The gateway typically sits between the end user who needs to send/receive SMS and a
mobile network's SMSC. Such gateways provide a choice of protocols, including HTTP,
SMTP, SMPP and Web services. Providers of SMS gateway services include SMS
aggregators and mobile operators. SMS gateways are also available as part of messaging
services such as AOL, ICQ and others.
It connects with (i) mobile network SMSCs in order to send/receive messages and/or (ii)
other SMS gateways in order to reach mobile subscribers on multiple mobile networks. It is
therefore possible that an SMS gateway has a combination of mobile network SMSC
connections and connections with other SMS gateways in order to provide its services.
However, there is the increasing potential for delivery problems with SMS the greater the
number of SMS gateways in the delivery chain.
In the simplified version, the basic model looks like:

Figure 8: Basic Model of a Gateway


The SMS gateway can be set up to handle the connections to the SMSCs. Here, the SMS text
messaging application only needs to know how to connect to the SMS gateway. To support
more SMSCs, we need to modify the settings of the SMS gateway. No change to the source
code of the SMS text messaging application is required. The use of an SMS gateway can
greatly shorten the SMS text messaging application's development time.
To connect to an SMS gateway, we use an SMSC protocol such as SMPP and CIMD. Some
SMS gateways support an HTTP / HTTPS interface. HTTP / HTTPS is easier to use than
SMSC protocols.
28 | P a g e

An SMS text messaging application connects to SMSCs through an SMS gateway and
the basic prototype would be:

Figure 9: Basic Prototype of SMS gateway


This text messaging application would be developed by using the django framework and
would work in the backend. We are using RapidSMSs simple application building process to
create this application.
Now, this application would interact with gateway using HTTP/HTTPS protocols and which
then would interact with mobile phones with AT commands.

5.1

Functioning of the SMS Gateway:

Below is the basic functionality of an SMS gateway on metastudio platform:


Suppose a registered metastudio user wants to post a topic or reply to an existing
thread in the forum without internet connection.
In this case, SMS service can be used with the help of SMS gateway.
The sender sends the required message to a subscriber identity module number
registered with metastudio's SMS gateway.

29 | P a g e

The gateway would parse the content of the received SMS, identify the metastudio
field it belongs to and post the SMS content in the respective field.
If the user is not registered, the gateway would reply the sender prompting him/her to
register.

Our first task on hand is to allow to make a user register at gstudio (metastudio) without
an email account by enabling him/her to fill in registration form with his mobile number
instead of email or both simultaneously, then a confirmation code will reach the user
through a mobile or email depending on the option enabling him/her to register using the
code. We are using RapidSMS as gateway and framework integrated with gstudio for
development of the SMS gateway and backend we are using as of now is Kannel.

5.2

RapidSMS at glance:

RapidSMS is a free and open-source framework for dynamic data collection, logistics
coordination and communication, leveraging basic short message service (SMS) mobile
phone technology. RapidSMS is easily customized to meet the specific needs of the
project and is scalable at an enterprise level. It is currently being utilized by large
multilateral organizations (such as the United Nations), development professionals (such
as the Earth Institute at Columbia University), and small NGOs and CBOs (such as
Tostan).
RapidSMS is written in Python and Django and is a framework for building highly
customized applications.

Figure 10: RapidSMS framework


30 | P a g e

RapidSMS is divided into a few core components:

Applications
RapidSMS applications, or apps, perform one or more of the following
functions:
o Performs the business logic
o Handles and responds to messages
o Extends the data model
o Creates a web interface with Django views and templates
For example, a registration application may provide a messaging protocol for
users to register themselves into the system.

5.3

Backends
Backends receive messages from external sources and deliver messages from
applications to external sources. We will talk about backends used shortly. We
will mostly use Kannel backend with the Gnowledge labs GSM modem for the
project. However for testing purposes we are using our android phones as GSM
modem.

Router
The router is the message processing component of RapidSMS. It provides the
infrastructure to receive incoming, send outgoing messages, and gluing together
our applications and backends.

Installing RapidSMS:

The recommended way to install RapidSMS is with Pip, since RapidSMS is available on
PyPI. In the terminal type the following command,
pip install rapidsms
Before starting a new RapidSMS project, the RapidSMS project template is used. The
project template needs the latest version of Django installed:
pip install Django

5.4

Starting a RapidSMS project integrated in gstudio environment:

The startproject management command is used with the template option.


django-admin.py startproject --template=https://github.com/rapidsms/rapidsmsproject-tem plate/zipball/release-0.17.0 --extension=py,rst gsms
, where gsms is the name of our project in gstudio.
Then, we installed the dependencies using the command:

31 | P a g e

pip install -r requirements/base.txt


The dependencies installed above are for rapidSMSs project to work. So as to integrate
the rapidSMS based work with gstudio we merged the dependencies of rapidSMS with
that of gstudio.

5.5

Application Structure:

We have created a RapidSMS app called csms in gstudio framework. Each application
defines a class that extends from rapidsms.apps.base.AppBase, kept in the app.py
submodule of the Django app.
The router maintains a collection of associated applications through which to route
incoming and outgoing messages. Application discovery is managed through the
BaseRouter.add_app method. The default router, BlockingRouter, loads applications
upon initialization by calling BaseRouter.add_app on each app listed in the optional apps
argument or in INSTALLED_APPS.
While the router provides the foundation for messaging processing, applications and
backends actually perform the message processing:

5.6

Applications: The router maintains a collection of related applications through


which it routes incoming and outgoing messages. Applications are defined in
INSTALLED_APPS and loaded, by default, when the router is instantiated via
add_app.
Backends: The router also maintains a collection of related backends to send
outgoing messages. Backends are defined in INSTALLED_BACKENDS and
loaded, by default, when the router is instantiated via add_backend.

Message Processing:

The Messaging API defines send and receive to route messages through the router. Messages
are processed via a series of phases, depending on direction. These phases are outlined
below.
1) Incoming Message Processing
Incoming messages are processed in five phases. Each application provides code for
executing the phases. The router method defines hooks which allow an application to
filter out a message, skip phases, or stop further processing.
a) Filter - Optionally abort further processing of the incoming message. The filter phase
is executed before any other processing or modification of the incoming message. If

32 | P a g e

b)

c)

d)

e)

an application returns True from this phase, the message is filtered out and no further
processing will be done by any application (not even cleanup).
Parse - Modify message in a way that is globally useful. This phase is used to modify
the incoming message in a way that could be useful to other applications. All
messages that arent filtered go through the parse phase of every application. No
INSERTs or UPDATEs should be done during this phase. Example: An application
adds metadata about phone number registration to each message.
Handle - Respond to the incoming message. The router passes incoming messages
through the handle phase of each application until one of them returns True. All
subsequent apps will not handle the message.
Default - Execute a default action if no application returns True during the handle
phase. For example, an application might want to provide additional help text or a
generic response if no other application has handled the message. The application can
return True from this method in order to prevent the remaining applications from
executing their default stage.
Cleanup - Clean up work from previous phases.

The order in which the router chooses applications to process messages is extremely
important, because each application will have the opportunity to block subsequent
applications from processing a message. receive_incoming processes messages in the
order they are listed in INSTALLED_APPS.
2) Outgoing Message Processing
The router receives each outgoing message through its outgoing method. Messages are
processed in a manner similar to incoming messages, except only one phase, outgoing, is
defined. In BaseRouter.send_outgoing, the message is processed sequentially by the routers
associated applications. However, the applications are called in reverse order with respect to
the order they are called in BaseRouter.receive_incoming, so the first application called to
process an incoming message is the last application that is called to process an outgoing
message. If any application returns False during the outgoing phase, all further processing of
the message will be aborted.
The logic for the outgoing phase is defined in a method of the same name in the AppBase
class. By default, no action is taken during this phase. Each subclass may choose to override
the default method to use custom logic on outgoing messages.

33 | P a g e

5.7

RapidSMS Backends:

Backends define how RapidSMS integrated with gstudio communicates with the outside
world. The router uses backends to send and receive messages and all text messages will
eventually pass through a backend. They handle a two-way messaging protocol:
Incoming messages: Messages received by RapidSMS from an external source linked
with gstudio. All incoming messages are received over HTTP and processed by a
Django view. Once received, backends will pass messages to the router for
processing.
Outgoing messages: Messages sent by RapidSMS linked with gstudio to an external
source. The router will pass messages to backends once processed. RapidSMS sends
messages over HTTP.
RapidSMS includes following backends in core for you to use:
Kannel backend
Vumi backend
HTTP backend
Database backend
Since we are going to work with Kannel Backend mostly we will not focus on other
backends in this report whereas Kannel Backend is discussed in next section of the report.

5.8

Kannel Backend:

Kannel is a free and open source SMS gateway configured for use with RapidSMS. We
used Kannel as it is possible to configure Kannel to connect directly to USB or serial
GSM modems as well as third party HTTP or SMPP gateways.
5.8.1

Installing Kannel

A kannel package is included with Ubuntu, so installation is very easy. The


following command is used to install kannel:
sudo apt-get install kannel
Note:
The thorough installation steps and more information about Kannel can be found on it
official site where documentation is available.
The documentation for Kannel consists of three parts:
User's Guide, i.e., the one you're reading at the moment.
Architecture and Design, in doc/arch or at

http://www.kannel.org/arch.shtml
The README and various other text files in the source tree.
34 | P a g e

By default in Ubuntu, Kannel starts a WAP gateway but does not start the SMS
gateway. To change this behavior, we first have to stop Kannel:
sudo service kannel stop
Now, /etc/default/kannel is edited and the line starting with START_SMSBOX is
uncommented. To do so the following command is written in terminal window:
sudo gedit /etc/default/kannel
Finally, we start the Kannel again:
sudo service kannel start
5.8.2 Setting up the fake SMSC for testing
Kannel includes support for a Fake SMSC which can be useful during setup for
testing both Kannel and RapidSMS. The relevant utility is included in the kannelextras package:
sudo apt-get install kannel-extras
To make things simpler, we first setup Kannel and RapidSMS to work with a
Fake SMSC, and then attempt to connect it to a USB modem.
5.8.3

Configuring the gateway

The configuration file can be divided into three parts: bearerbox configurations,
smsbox configurations and wapbox configurations. Bearerbox part has one 'core'
group and any used SMS center groups, while wapbox part has only one wapbox
group. In smsbox part there is one smsbox group and then number of sms-service
and sendsms-user groups. Configurations involving wapbox part wont be used in
our project.
To set up a SMS Kannel, the 'core' group in the configuration file has to be edited,
and 'smsbox' group plus one or more 'sms-service' groups, plus possibly one or
more 'sendsms-user' groups are defined.
For the 'core' group, we must set the following variable: smsbox-port. A sample
configuration file smskannel.conf is supplied with the standard distribution.
The easiest way to get Kannel working with RapidSMS is to start with a sample
Kannel configuration. To get started, copy and paste the following into
/etc/kannel/kannel.conf, replacing everything currently in the file:

35 | P a g e

# CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS


# For any modifications to this file, see Kannel User Guide
# If that does not help, see Kannel web page (http://www.kannel.org) and
# various online help and mailing list archives
#
# Notes on those who base their configuration on this:
# 1) check security issues! (allowed IPs, passwords and ports)
# 2) groups cannot have empty rows inside them!
# 3) read the user guide
include = "/etc/kannel/modems.conf"
#--------------------------------------------# CORE
#
# There is only one core group and it sets all basic settings
# of the bearerbox (and system). We should take extra notes on
# configuration variables like 'store-file' (or 'store-dir'),
# 'admin-allow-ip' and 'access.log'
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = CHANGE-ME
status-password = CHANGE-ME
admin-deny-ip = "*.*.*.*"
admin-allow-ip = "127.0.0.1"
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
#--------------------------------------------# SMSC CONNECTIONS
#
# SMSC connections are created in bearerbox and they handle SMSC
specific
# protocol and message relying. We need these to actually receive and
send
# messages to handset, but can use GSM modems as virtual SMSCs
# Here is a sample SMSC for use with the /usr/lib/kannel/test/fakesmsc
command
group = smsc
36 | P a g e

smsc = fake
smsc-id = FAKE
port = 10000
connect-allow-ip = 127.0.0.1
#--------------------------------------------# SMSBOX SETUP
#
# Smsbox(es) do higher-level SMS handling after they have been received
from
# SMS centers by bearerbox, or before they are given to bearerbox for
delivery
group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
sendsms-chars = "0123456789 +-"
log-file = "/var/log/kannel/smsbox.log"
log-level = 0
access-log = "/var/log/kannel/smsbox-access.log"
reply-couldnotfetch = "We message could not be processed at this time.
Please try again later. (err=couldnotfetch)"
reply-requestfailed = "Ourr message could not be processed at this time.
Please try again later. (err=requestfailed)"
reply-couldnotrepresent = "Our message could not be processed at this
time. Please try again later. (err=couldnotrepresent)"
http-request-retry = 3
http-queue-delay = 10
# SEND-SMS USERS
#
# These users are used when Kannel smsbox sendsms interface is used to
# send PUSH sms messages, i.e. calling URL like
# http://kannel.machine:13013/cgibin/sendsms?username=tester&password=foobar...
# This is the username and password that RapidSMS uses to deliver
SMSes to
# Kannel. It must also set the 'smsc' variable in the query string, so that
# Kannel knows which SMSC to use to route the message.
group = sendsms-user
username = rapidsms
password = CHANGE-ME
user-deny-ip = "*.*.*.*"
user-allow-ip = "127.0.0.1;"
37 | P a g e

#--------------------------------------------# SERVICES
#
# These are 'responses' to sms PULL messages, i.e. messages arriving
from
# handsets. The response is based on message content. Only one smsservice is
# applied, using the first one to match.
# The 'ping-kannel' service let's you check to see if Kannel is running,
# even if RapidSMS is offline for some reason.
group = sms-service
keyword = ping-kannel
text = "Kannel is online and responding to messages."
# There should be always a 'default' service. This service is used when no
# other 'sms-service' is applied. These relay incoming messages from any
# configured SMSCs to the appropriate HTTP backend URLs in
RapidSMS.
# By setting 'accepted-smsc', we are assured that messages are routed to
# the appropriate backend in RapidSMS.
group = sms-service
keyword = default
catch-all = yes
accepted-smsc = FAKE
# don't send a reply here (it'll come through sendsms):
max-messages = 0
get-url = http://127.0.0.1:8000/backend/kannel-fakesmsc/?id=%p&text=%a&charset=%C&coding=%c
A file called modems.conf is then copied from where Ubuntu installed
it as follows:
sudo cp /usr/share/doc/kannel/examples/modems.conf /etc/kannel/
Next, restart Kannel to reload the new configuration:
sudo service kannel restart
5.8.4

Adding a backend for the fake SMSC to RapidSMS

Now that Kannel is installed and configured correctly, adding support for the
Kannel backend to our existing RapidSMS project is not difficult. To begin,
simply add the following to the existing INSTALLED_BACKENDS
configuration in settings.py file:
38 | P a g e

INSTALLED_BACKENDS = {
# ...
# other backends, if any
"kannel-fake-smsc" : {
"ENGINE": "rapidsms.backends.kannel.KannelBackend",
"sendsms_url": "http://127.0.0.1:13013/cgi-bin/sendsms",
"sendsms_params": {"smsc": "FAKE",
"from": "123", # not set automatically by SMSC
"username": "rapidsms",
"password": "CHANGE-ME"}, # or set in
localsettings.py
"coding": 0,
"charset": "ascii",
"encode_errors": "ignore", # strip out unknown (unicode) characters
},
}
"host" and "port" should no longer be included in the backend configuration.
Next, we need to add an endpoint to our urls.py for the newly created backend.
We can do this like so:
from django.conf.urls.defaults import *
from rapidsms.backends.kannel.views import KannelBackendView
urlpatterns = patterns('',
# ...
url(r"^backend/kannel-fake-smsc/$",
KannelBackendView.as_view(backend_name="kannel-fake-smsc")),
)
Now, we are able to start RapidSMS like so:
./manage.py runserver
And test connection using the echo app in RapidSMS (if installed in our project):
/usr/lib/kannel/test/fakesmsc -m 1 "123 789 text echo hi"
A message is seen get echoed back on the last line:
INFO: Got message 1: <123 123 text hi>

39 | P a g e

5.8.5

Adding the GSM modem to the Kannel configuration

Using the base configuration given above, we add the following to the section
titled SMSC CONNECTIONS in /etc/kannel/kannel.conf, changing the device
= /dev/ttyUSB0 line so that it points to the right device:
group = smsc
smsc = airtel
smsc-id = usb0-modem
my-number = +919660578188
modemtype = auto
device = /dev/ttyUSB0
Next, we add the following sms-service at the end of the file, which will send
incoming messages from the modem to RapidSMS via HTTP:
group = sms-service
keyword = default
catch-all = yes
accepted-smsc = usb0-modem
# don't send a reply here (it'll come through sendsms):
max-messages = 0
get-url = http://127.0.0.1:8000/backend/kannel-usb0smsc/?id=%p&text=%a&charset=%C&coding=%c
Make sure to restart Kannel to reload the configuration:
sudo service kannel restart
5.8.6

Adding a backend for the GSM modem to RapidSMS

Finally, we add a second Kannel backend to our settings.py which will setup the
necessary router infrastructure to send and receive messages via the USB modem
you configured above in Kannel:
INSTALLED_BACKENDS = {
# ...
"kannel-usb0-smsc" : {
"ENGINE": "rapidsms.backends.kannel.KannelBackend",
"sendsms_url": "http://127.0.0.1:13013/cgi-bin/sendsms",
"sendsms_params": {"smsc": "usb0-modem",
"from": "+SIMphonenumber", # not set automatically by
SMSC
"username": "rapidsms",
40 | P a g e

"password": "CHANGE-ME"}, # or set in


localsettings.py
"coding": 0,
"charset": "ascii",
"encode_errors": "ignore", # strip out unknown (unicode) characters
},
}
"host" and "port" should no longer be included in the backend
configuration.
Next, we need to add an endpoint to our urls.py for the newly created
backend. We can do this like so:
from django.conf.urls.defaults import *
from rapidsms.backends.kannel.views import KannelBackendView
urlpatterns = patterns('',
# ...
url(r"^backend/kannel-usb0-smsc/$",
KannelBackendView.as_view(backend_name="kannel-usb0-smsc")),
)
Now, the next time we call ./manage.py runserver, Django begins processing
requests for both the Kannel backends that we created (one for the fake SMSC
and one for the GSM modem).
5.8.7

Delivery Report

RapidSMS can take advantage of Kannels SMS Delivery Report functionality.


This is useful as we would like to track the status of a message after its been
passed to Kannel for processing. Kannel will use a callback URL to notify us.
Enabling this feature will allow us to view delivery reports, for each message, in
the Django admin. The steps to add delivery report feature to Kannel are:
1) Add rapidsms.backends.kannel to INSTALLED_APPS.
2) Add kannel/ URLs to your urlconf
3) Add the necessary database tables:
python manage.py syncdb migrate
4) Update the Kannel backend settings with delivery_report_url. This is the URL
Kannel will use to notify RapidSMS. Kannel requires a full URL, including
the protocol and authority, even if we are only communicating locally.
RapidSMS will automatically append the necessary path and query string
41 | P a g e

arguments, so we only need to include the protocol and authority information,


such as http://127.0.0.1:8000 or http://example.com.
The delivery reports can be viewed in the Django admin.

5.9

Benefits of the project:


The Gateway would be extremely reliable and developer friendly.
It will handle simple HTTP Post or XML access.
It will allow to send/receive multiple messages at once to many different
recipients/senders.
Since almost everyone today carries a mobile, SMS gateway will provide an easy and
fast way to connect with other metastudio members.
It will facilitate participation of wider audience, helping them to conribute and
connect with science

5.10 Scope of the project

In future, the features can be enhanced in terms of sending and receiving the texts.
In terms of outgoing SMS, various features can be developed in terms of notifying the
users about his activities on metastudio. We can develop the features corresponding
to each and every email based notification.
In terms of receiving the SMS at metastudio, we can develop various handlers to
parse the content of the messages received. This handlers would use the various
methods and respond according to the text received whether in terms of sending an
SMS back or identifying the field to which the text belongs and posting it to
respective field.

42 | P a g e

6. CONCLUSION
After completion of the projects, there will be two new features with which Metastudio will be
endowed with:
1. Chatb Integration with Metastudio:
An App to let users/members interact with each other and have real time P2P
communication using their browsers.
This nodal app would enable quick, efficient and user friendly communication
between members of a group within Metastudio.
2. Developing an SMS gateway:
Providing people access to Metastudio portal using simple wireless carrier i.e. using
an SMS.
The project would ease the accessibility to communicate and would introduce social
networking platform on Metastudio.

43 | P a g e

7. REFERENCES
i.

Bengtsson, P. (2014, June 4). How and why to use django-mongokit(a.k.a Django to
MongoDB). . Retrieved from http://www.peterbe.com/plog/how-and-why-to-use-djangomongokit

ii.

django. (2014, May 21). Django Documentation. Retrieved from


https://docs.djangoproject.com/en/1.6/intro/tutorial01/

iii.

django. (2014, June 22). Django Documentation. Retrieved from


https://docs.djangoproject.com/en/1.6/intro/tutorial02/

iv.

django. (2014, June 23). Django Documentation. Retrieved from


https://docs.djangoproject.com/en/1.6/intro/tutorial03/

v.

django. (n.d.). Django Documentation. Retrieved from


https://docs.djangoproject.com/en/1.6/intro/tutorial04/

vi.

django. (2014, May 25). Django Documentation. Retrieved from


https://docs.djangoproject.com/en/1.6/intro/tutorial05/

vii.

django. (2014, May 26). Django Documentation. Retrieved from


https://docs.djangoproject.com/en/1.6/intro/tutorial06/

viii.

django. (2014, July 7). Django Documentation. Retrieved from


https://docs.djangoproject.com/en/dev/topics/http/urls/

ix.

Bengtsson, P. (2014, June 4). How and why to use django-mongokit(a.k.a Django to
MongoDB). . Retrieved from http://www.peterbe.com/plog/how-and-why-to-use-djangomongokit

x.

mongoDB. (2014, May 29). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

xi.

mongoDB. (2014, May 29 ). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/tutorial/getting-started/

xii.

mongoDB. (2014, May 29). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/tutorial/generate-test-data/

xiii.

mongoDB. (2014, May 30). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/core/crud-introduction/

xiv.

mongoDB. (2014, May 30). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/core/write-operations-introduction/

xv.

mongoDB. (2014, May 30). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/core/read-operations-introduction/

44 | P a g e

xvi.

mongoDB. (2014, June 1). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/reference/sql-comparison/

xvii.

mongoDB. (2014, June 1). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/core/indexes-introduction/

xviii.

mongoDB. (2014, June 1). MongoDB Manual. Retrieved from


http://docs.mongodb.org/manual/core/index-types/

xix.

Nielson, M. (2014, June 9). Write your first MapReduce program in 20 minutes.

xx.

tutorialspoint.com. (2014, May 20). Python Programming. Retrieved from


http://www.tutorialspoint.com/python/

xxi.

wikipedia. (2014, June 4). Map Reduce.

xxii.

wikipedia. (2014, May 28). MongoDB. Retrieved from


http://en.wikipedia.org/wiki/MongoDB

xxiii.

RapidSMS (2014, July 1) Framework. Retrieved from


https://www.rapidsms.org/

xxiv.

kannel. (2014, July 3) Backend. Retrieved from


http://www.kannel.org/

45 | P a g e

8. GLOSSARY
1. SMTP: Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail
(e-mail) transmission. While electronic mail servers and other mail transfer agents use
SMTP to send and receive mail messages, user-level client mail applications typically use
SMTP only for sending messages to a mail server for relaying. For receiving messages,
client applications usually use either POP3 or IMAP.
2. HTTP: The Hypertext Transfer Protocol (HTTP) is an application protocol for
distributed, collaborative, hypermedia information systems.[1]HTTP is the foundation of
data communication for the World Wide Web. Hypertext is structured text that uses
logical links (hyperlinks) between nodes containing text. HTTP is the protocol to
exchange or transfer hypertext. HTTP functions as a request-response protocol in the
client-server computing model. HTTP is designed to permit intermediate network
elements to improve or enable communications between clients and servers.
3. Metastudio:It is a collaborative workspace for shaping up education and research. We
can discuss, design and construct various educational initiatives collaboratively and
create a social network with members of a community by (a) campaigning about the
educational initiatives and (b) broadcast the work to the world through blogs, articles,
share resources and seek responses.We can do this by involving any citizen to join a
research project or by designing a project that provides concrete learning experiences to
participants.
4. Node: In communication networks, a node (Latin nodus, knot) is either a connection
point, a redistribution point or a communication endpoint (some terminal equipment).
The definition of a node depends on the network and protocol layer referred to. A
physical network node is an active electronic device that is attached to a network, and is
capable of sending, receiving, or forwarding information over a communications channel.
A passive distribution point such as a distribution frame or patch panel is consequently
not a node.
5. SMS: Short Message Service (SMS) is a text messaging service component of phone,
Web, or mobile communication systems. It uses standardized communications protocols
to allow fixed line or mobile phone devices to exchange short text messages. The term
"SMS" is used for both the user activity and all types of short text messaging in many
parts of the world. SMS is also employed in direct marketing, known as SMS marketing.
6. pyGSM: pyGSM is a Python module which uses pySerial to provide a nifty interface to
send and receive SMS via a GSM Modem. It was ported from RubyGSM, and provides
(almost) all of the same features.
7. AJAX: It is a group of interrelated Web development techniques used on the client-side
to createasynchronous Web applications. With Ajax, Web applications can send data to,
and retrieve data from, a server asynchronously (in the background) without interfering
with the display and behavior of the existing page. Data can be retrieved using the
46 | P a g e

XMLHttpRequest object. Despite the name, the use of XML is not required; JSON is
often used instead (see AJAJ), and the requests do not need to be asynchronous.
8. Iframe: An iframe is used to display a web page within a web page. The height and
width attributes are used to specify the height and width of the iframe.The attribute
values are specified in pixels by default, but they can also be in percent (like "80%").
9. SMSC: A short message service center (SMSC) is a network element in the mobile
telephone network. Its purpose is to store, forward, convert and deliver SMS messages.
The full designation of an SMSC according to 3GPP is Short Message Service - Service
Center (SMS-SC) Basic Trajectories of SMS are
a. From Mobile to another Mobile, this trajectory is referred as MO-MT (Mobile
Originated - Mobile Terminated).
b. From Mobile to a content provider (also called as Large Account / ESME), this
trajectory is referred as MO-AT (Mobile Originated - Application Terminated).
c. From Application to a Mobile, this trajectory is referred as AO-MT (Application
Originated - Mobile Terminated).
10. WAP: Wireless Application Protocol (WAP) is a technical standard for accessing
information over a mobile wireless network. A WAP browser is a web browser for
mobile devices such as mobile phones that uses the protocol. WAP Push was
incorporated into the specification to allow WAP content to be pushed to the mobile
handset with minimum user intervention. A WAP Push is basically a specially encoded
message which includes a link to a WAP address. WAP Push was specified on top of
WAP Datagram Protocol (WDP); as such, it can be delivered over any WDP-supported
bearer, such as GPRS or SMS.Most GSM networks have a wide range of modified
processors, but GPRS activation from the network is not generally supported, so WAP
Push messages have to be delivered on top of the SMS bearer.
11. CIMD: Computer Interface to Message Distribution (CIMD) is a proprietary short
message service centre protocol developed by Nokia for their SMSC .
12. Modem: A modem (modulator-demodulator) is a device that modulates an analog carrier
signal to encode digital information and demodulates the signal to decode the transmitted
information. The goal is to produce a signal that can be transmitted easily and decoded to
reproduce the original digital data. Modems can be used with any means of transmitting
analog signals, from light emitting diodes to radio.

47 | P a g e

You might also like