Content uploaded by Jakapan Suaboot
Author content
All content in this area was uploaded by Jakapan Suaboot on Nov 20, 2017
Content may be subject to copyright.
A Collaboration Agent for Exploiting Legacy Phones in
Assistive UPnP-based Home Environments
Jakapan Surbot and Suntorn Witosurapot
Department of Computer Engineering, Faculty of Engineering,
Prince of Songkla University, Hatyai, Songkhla, 90112 Thailand
Email: s5010120005@psu.ac.th, wsuntorn@coe.psu.ac.th
Abstract
Universal Plug and Play (UPnP) Technology has
been known as a potential candidate for enabling
smart assisted home environments that aids the
elderly or disability persons in being independent. To
date, the research works related to UPnP extensions
are still active, but rather considering on the Internet
facilities. In this paper, we argue that the legacy
telephone system needs to be included into the UPnP
scheme, since it is the most common of residential
networks, especially in the rural areas. We present
how the ordinary PC-based telephone exchange
featuring Asterisk open source software can become
aware to the presence of UPnP signals by means of a
cooperation agent. In addition, we provide evidence
from our first implementation, where the UPnP event
notification can be realized in the Asterisk’s
telephony gateway functionality of assistive UPnP-
based home environment.
Key Words: Bridging mechanism, UPnP, Telephony
gateway
1. Introduction
Universal Plug and Play (UPnP) [1] is widely
known as a standard of functional abstraction for
self-configuring and self-describing intelligent
devices in a local home or office environment. The
ultimate goal is to provide an invisible networking
for smart devices in automated home environment,
without explicit human intervention. Therefore,
UPnP network is well suited for providing dependant
people, owing to disability or aging, with
accessibility and dedicated service provisioning in
being independent. Due to the broadcasting behavior
of simple service discovery protocol [2], the UPnP
concerns with service provisioning merely in a single
network an d, th erefor e, providing no means of
connection to the other networks, unless some extra
devices are inevitably involved.
In response to the aforementioned UPnP
inadequacy, a large number of works have been
researched for developing smart mechanisms or
agents aiming specially at the gateways of UPnP
networks. The idea is that this sort of special gateway
device acts as a bridge for allowing UPnP
connectivity to be referred to (or carried on with)
remote networks of which the involved technology
may not necessarily be th e same. Instead of bridging
a pair of UPnP and other standard in the Internet, our
work in this paper takes a bridging method for the
UPnP network and the legacy telephone network in
such a way that the plain-old teleph ones can be
exploited by the UPnP control points. In more
specific, we propose a collaboration agent applying at
the telephony gateway device that will be aware of
the event notification occurred in the UPnP home
environment, as shown in Fig. 1. We believe that our
proposed agent would be contributed to a broaden
adoption of sophisticated services that involve the
cooperation of UPnP devices and some other devices
from h eterogeneous networ ks. An example of prime
application is Telerehabilitation [3], where the event
notification from UPnP networks causes an alarm as
an emergency phone call of hazardous state of patient
at a distance.
The rest of the paper is organized as follows. In
Section 2 we firstly present a brief overview of UPnP
architecture and describe its eventing notification
mechanism. In Section 3 we describe how such a
mechanism can be incorporated into the telephony
gateway device. In Section 4, we discuss an
implementation when the Asterisk open source
software is employed for telephon y gateway
functionality. Finally, we conclude the paper in
Section 5.
Figure 1. UPnP system in an assisted home network
54
JCSSE2010 - The 7th International Joint Conference on Computer Science and Software Engineering
2. UPnP and Event Notification
2.1 UPnP Architecture
In essence, the UPnP standard provides an
abstraction layer for ad-hoc networking
functionalities between devices in an autonomous
fashion. These involve processes, such as joining a
network and device discovery. Since UPnP works on
a basis of asymmetric networking, there is no need
for a centralized server to manage the devices.
Therefore, in the UPnP system, all devices are not
necessar ily the same and can work as a “Control
Point” for issuing actions, a “Device” for receiving
actions, or even both.
Each device contain embedded functional units
known as Services, which are actually the W3C’s
Web Services standard [4] for remote service
invocation on heterogeneous devices via XML-based
service description and SOAP acces s protocol. In this
regard, Control Point can be easily seen as the
consumer of devices and services and when it is
integrated within a device, an intelligent device can
be formed so that transparent interoperability among
the same sort of device locating in the same subnet
can be enabled. However, it is common that a Control
Point will be likely implemented as a standalone
application running on Personal Computer so users
can control multiple devices in a simple manner.
2.2 Events and Notification Mechanism
In standard UPnP Architecture as shown in Fig. 2,
a control point will perform to search for UPnP
devices and services. A search request is sent out for
all UPnP devices using Simple Service Discovery
Protocol (SSDP) – an extended set of HTTP
messages but sending over UDP transport protocol –
and then the devices a response back to the originated
control point. Also, when a new UPnP device en ters
the network, it broadcast a device advertisement
message so that its offered services will become
known to all other UPnP devices and control points
on the local network.
Figure 2. UPnP Protocol Stack [2]
To access one or more services pr ovided by the
device, a control point will perform some action, in
which its argument will be related to the state
variable of the target service, such as querying or
changing the device’s state variable. Based on the use
of well-known XML and SOAP technologies, the
service request from the control point in a form of
XML document will be sent to the URL address of
the device. Once the service request has been
performed at the target device, an acknowledgement,
which is also an XML document, will be responsive
in return.
The operations described above are also applied
for the case that a contr ol point, or th e other device,
subscribes to the event notification service of an
UPnP device; it will stay informed by the device
about the event that results in changes in values of
state variables. Here, the event protocol called GENA
plays the key role of supporting through an extended
set of HTTP messages over TCP transport protocol.
Therefore, it is certain that, in order to achieve th e
goal of UPnP service extension , our proposed
mechanism should corporate to some extent with the
GENA eventing protocol.
3. Proposed Collaboration Agent
The basic architecture of our proposed agent
consists of UPnP and Asterisk agents working in
collaboration. While both agents are not necessarily
co-located at the same UPnP control point (unlike the
one shown in Fig. 3), the Asterisk agent is restricted
to locate at the machine serving as Asterisk server.
However, in the module viewpoint, the str ucture of
collaboration agent is composed of two key modules
as in the following:
UPnP module: It is any UPnP control point
acting as the event notification server maintains a
software list of XML schemas describing the
events supported. Although XML schema may
be supplied from many different sources, we are
interested to the one that related to changes from
any devices. Whenever changes are occurred, the
event notification server will be notified via the
GENA pr otocol as described previousl y. Then, it
becomes easy to relay the notification signal to
the Asterisk agent.
Figure 3. Collaboration Agent Architecture
55
JCSSE2010 - The 7th International Joint Conference on Computer Science and Software Engineering
Asterisk module: It is actually the controller of
Asterisk telephony gateway unit, which will take
action in response to the notification signal.
However, the operations are detailed separately
in the following subsections.
3.1 Asterisk Dial Plan
For the case of Asterisk telephony gateway [5], a
dial plan need to be pr epared in advan ce before any
incoming software call can be responded. The key
configuration file related to a dial plan is named
extensions.conf, where the logical response of
incoming, outgoing and internal calls is clearly
defined. Although the dial plan method can allow us
to use the System command to call external
programs, the call file method is preferred since it
allows us the more control of the program execution
or interaction, rather than just waiting for a return
from the OS shell execution as found in the dial plan
method.
With call files, we can specify how to perform the
call or what to do when the call is answered by
writing a script file and placing it in the outgoing
spooling directory. Then, it will be the function of
pbx_spool module of Asterisk to examine this
directory periodically and execute every call files it
may find. An example of call file is illustrated in Fig.
4. Here, the call file syntax describe how to initiate a
call via some control parameters, such as
Channel for specifying the communication
channel used for a new conn ection. (Some
available options are SIP for SIP technology and
ZAP for typical phone technology). For example,
the SIP/jakky refers to a SIP based channel and a
resource named jakky.
WaitTime for specifying the waiting time
before the call is considered fails.
RetryTime and Maxretries for specifying
the waiting time before attempting a new retry and
the number of retries before failing th e call
accordingly.
For the call file syntax of outgoing scripts, some
control parameters are those of dial plan commands,
such as
Context for referring to the context name
that specifies a gr oup of extension commands for
a certain dial plan. the Outgoing context in the
given example sh ows on ly two commands that
will be catered for outgoing calls.
Extension for specifying at which internal
extension will be used to make a new call. In the
given example, it is the extension number 1300.
Priority for controlling the flow priority in
which the command will be executed.
Figure 4. An example of call file
3.2 Java Application with AGI Script
For writing a program that will interact with
Asterisk server, we need to use Asterisk Gateway
Interface (AGI) to write a dial plan application,
which is normally performs a complex task, such as
playing audio files, doing voice menu prompt,
accessing database etc. In this work, we use Asterisk-
Java [6] to develop a java application for interacting
with the Asterisk server. An example of AGI script
can be illustrated in Fig. 5. It works by extending
BaseAgiScript to perform our own tasks, which are
simply answering a call, playing a voice file and
hanging up the call.
Figure 5. An example of AGI Script file:
HelloAgiScript.java
Figure 6. The Script to be added in the
“extension.conf” file
Noted that we need to add a call to our script from
the dial plan, which is in the file extension.conf of
Asterisk server (see Fig. 6), where
172.30.132.195 is the IP address of the
server where the application is placed. However,
this IP address can be as same as that of Asterisk
server if the application and the asterisk are
working on the same server .
hello.agi is the script name we use for
mapping to our HelloAgiScript that we just
import
org.asteriskjava.fa
stagi.AgiChannel ;
import org.asteriskjava.fastagi.AgiE xception;
import org.asteriskjava.fastagi.AgiReques t;
import org.asteriskjava.fastagi.BaseAgiScript;
public class HelloAgiScript extends BaseAgiScript {
public void service(AgiRequest r equest, AgiChannel
channel) throws AgiException {
//Answer the call
answer();
//Play the audio fil e named welcome.gs m
streamFile( "welcome");
//finish the call
hangup();
}
}
[outgoing]
exten => 1300,1,Agi( agi://172.30.132.195/hell o.agi)
# How to initial a call
Channel: SIP/jakky
WaitTime: 30
RetryTime: 60
MaxRetries: 1
# What to do when call an swered
Context: outgoing
Extension: 1300
Priority: 1
56
JCSSE2010 - The 7th International Joint Conference on Computer Science and Software Engineering
created. The mapping can be done easily through
a properties file called fastagi-
mapping.properties that must be on the
classpath when we start the DefualtAGIServer as
follow: hello.agi = HelloAgiScript For more
details, see [6].
3.3 Handling of UPnP Notification in Asterisk
Gateway
In order to develop the UPnP task for handling
the UPnP event notification in the AGI script
previously shown in Fig. 5, we need to develop the
codes for UPnP control and response. This is
undesirable task and can be avoided by using the
support of some open source software for UPnP
progr ammers. In this work, we choose CyberLink for
Java [7] since it allows us to use Java language for
our application development and also is still active to
date.
Figure 7. Class Diagram of UPnP Control Point [7]
Based on th e Cyber Lin k for Java’s UPnP library,
the class diagram of UPnP control point is showed in
Fig. 7. All of the interfaces foun d in this diagram
are as follows:
NotifyListener, a listener for the notified
events when devices enter or exit from the
network automatically,
SearchResponseListener, a listener for the
reply of search action when a control point wants
to update the device list,
EventListener, a listener for the event
notification when the subscribed devices change
the state of their service parameters.
In Fig. 8, an example implementation of
EventListener interface is done by the
eventNotifyRecieved() method (see Fig. 7 above). At
the beginn ing, the device name and it state variables
are checked whether it matches to our concern s, e.g.
the Finish status in our example. If this condition is
met, the makeCallFile() will create an Asterisk’s call
file (like the one shown in Fig. 4) and placing it in the
outgoing spoolin g dir ector y of Asterisk server as
described in section 3.1. In the next moment, when
scripts in the call file are executed by the pbx_spool
module of Asterisk, an outgoing call using SIP
channel and details given in the Jakky resource will
be in result. If the extension number 1300 is
configured as in Fig. 6, all occurred operations will
follow the AGI script written in the
HelloAgiScript.java. For a clear view of all activities,
see the sequence diagram in Fig. 9.
Figure 8. An example implementation of
EventListener
Figure 9. Sequence Diagram for Handling UPnP
Event Notification
4. Experimental Implementation
We have implemented an experimental version of
an UPnP event notification system, where the
Asterisk telephony gateway is co-existed with an
UPnP control point on the same machine. UPnP
devices in the same network are all running on the
PC machines for the ease of monitoring and testing
all operations. The overall system can be depicted as
in Fig. 10 and is heavily based on the sample devices
provided by the CyberLink for Java [7] for a quick
prototype of UPnP-awar e Telephony Gatewa y
System.
Several testing scenarios have been performed.
For instance, in a case that UPnP control point has
been subscr ibed to the embedded machine so that the
machine status could be observed. Referred to the
sequence diagram in Fig.9, we should notice the
public
void
eventNo
tifyReceived(String uui d,
long
seq,
String varName, String value) {
Device device;
String friendl yName = "";
Service service = c ontrolPoint.getSubscr iberService(uuid);
If ((varName != null) && ( value.length() < 0)){
//Trace back to chec k what a device is
device = service.getDe vice();
friendlyName = device.ge tFriendlyName( );
}
If ((value.equals( "Finish") && fri endlyName.equals ( "My
Device")) {
makeCallFile();
}
}
57
JCSSE2010 - The 7th International Joint Conference on Computer Science and Software Engineering
same pattern of actions and responses as shown there.
As expected, when the embedded mach ine working
under the command of a remote control device
updated its state variable, an event notification
message will be informed to the control point.
However, the special case is when the embedded
machine finishes its own operation and hence the
message “Finish” is specified in the event notification
message. This activates the eventNotifyRecieved
function, which works in similar to the one shown in
Fig. 8 above, to be perfor med. As a result, the phone
call is made by the Asterisk server, so the ringing
sound can be noticed. When someone pickups the
phone, he/she will hear the message in form of a pre-
recorded voice kept on the Asterisk machine.
However, if no one answers the call, the second
attempt will be made after delaying for 60 seconds.
This follows exactly all of the script command found
in the example call file as shown in Fig. 4.
Therefore, based on our experiment, we yield the
good r esults for sh owing that the Asterisk telephony
gateway can be progr ammed to become responsive
especially to UPnP event notification protocol.
Figure 10. An experimental system for UPnP-aware
Teleph ony Gatewa y
5. Related work
There exists a very few published works aiming
to provide bridging mechanism between UPnP based
services and traditional voice services in legacy
telephone network, which is particularly interested in
our work. Most of them are all focused on en able
service mapping for UPnP devices to work across the
devices of different domain in the Internet, e.g. UPnP
and SIP [8], UPnP and SNMP [9], UPnP and Jini
[10], to name a few in the reference.
6. Conclusion and Discussion
In this paper, we propose a collabor ation agent
that combines the use of UPnP eventing protocol
(GENA) and telephone gatewa y. This pr ovides a
favorable means for UPnP system to be monitored or
operated over the telephone network, thus extending
the UPnP scope to work beyond the local network.
As evidence, our experimental prototype has been
prepared and shown successfully in event notification
via a telephone call with pre-recorded soun d for
warning. Note that, owing to the salient feature of
Asterisk gateway, such a telephone call can make
possible through either legacy phone network or SIP-
based telephony network in the Internet.
7. References
[1] UPnP Forum. http://www.upnp.org,
[2] I.K. Ibrahim, “Handbook of Research on Mobile
Multimedia,” Idea Group Inc., London, 2006,
pp. 165-178.
[3] Tel erehabilitation, Wikipedia,
http://en.wikipedia.org/wiki/Telerehabilitation
[4] W3C Web Services Activity.
http://www.w3.org/2002/ws/
[5] B. Jackson C. Clark III, L. Chaffin and J. Long,
Aster isk Hacking. Bur lington, MA: Syngress
Publishing, 2007.
[6] S. Reuter, Asterisk-Java Tutorial, June 2007,
http://asterisk-java.org/0.2/tutorial.html
[7] S. Konno, CyberLink Development Package for UPnP
Devices, ver 1.7, March 2006.
http://www.cybergarage.org/net/upnp/java
[8] S. Chi ntada, P. Sethuramalingam and G. Goffin,
Converged Services for Home using a SIP/UPnP
software b ridge solution, in proceeding of Cons umer
Communications and Networking Conference 5th
IEEE, pp. 790 - 794, 2008.
[9] P. Park, K. Lim, and K. Choi, Brid ging M ethod for
Integration The UPnP Domain And The Legacy SNMP
Domain, Proceedings of the IADIS International
Confe rence WWW/Int ernet 2003, ICWI 2003, Algarve,
Portugal, November 5-8, pp.1249-1250 , 2003.
[10] H. J. Lee and S. J. Kim, A Standard Method-Based
User-Oriented Integrated Architecture for Supporting
Inte roperabi lity a mong Heterogeneous Home Ne twork
Middlewares, International Journal of Smart Home
Vol. 1, No. 1, pp. 57-64, January, 2007
58
JCSSE2010 - The 7th International Joint Conference on Computer Science and Software Engineering