Internet Toaster Project
- Implementation of SIP Subscribe and Notify methods in Device Control project-

Xu Li
Columbia University
51 Pearl Street, 3rd Floor
New Haven, CT 06511
USA
xl71@columbia.edu

Abstract

Home networking has become popular in USA. The most popular home networking protocol is x10 [1], which has a lot of products in the market today. Also there is a big demand for controlling home appliances from internet.
In addition to that Session Initiation Protocol(SIP)[2] for setting up, controlling sessions has become popular in the field of internet telephone calls and electric appliances. With its feature of signaling message, it is suitable for controlling devices from remote environment.
The goal of this project is to implement event notification service for clients. Through the work of this project, I have implemented SIP Subscribe method and Notify method.

Introduction

In the SIP client and server system, clients request SIP messages to servers and get response message from servers. SIP message has header info, which includes tags for controlling method, client properties and the body, which includes media info for exchanging data between client and server. The details of the SIP message format are shown in the references.
To subscribe a presence with SIP message, "Subscribe" method is used,  which was proposed in the draft of the ietf group. I add "Subscribe" methods to the SIP library. In the "Subscribe" method, the SIP gateway add, update, or delete a subscription record stored in the xml file, and return the current status of the device to the subscriber by calling x10 APIs.
To notify subscriber, the SIP gateway listen the device event. If some device event happens, the listener thread will notify subscriber by going through the subscription records in the xml file.

In this project, I have made the following software, which are developed and tested on sun Solaris machine.
Add "SUBSCRIBE" command handler to libsip++, and add event listener to the sipua to implement the "NOTIFY" method.

Related Work

Koji Kikkawa implemented "DO" command for sip device control project.

Architecture

System Structure

System structure is shown in the following figure. CM11A(x10 adapter) is connected to Unix workstation(sun) via serial line and other CM11A adapters through power line. Electric appliances are connected to CM11A. SIPUA(SIP User Agent) works on the Unix workstation and client programs such as sipc work on other Unix workstations.


Fig. System Structure

Software architecture

The software architecture is shown in the following figure. Sipc, SIP client program for SIP, sends SUBSCRIBE commands to sipua. After receiving the SUBSCRIBE command, sipua calls OnIncomingRequest() function and passes SUBSCRIBE commands to the function. Then the function authenticates the subscriber. After that, it calls OnSubscribe() to process the subscription request, like adding a new subscription record, updating a old subscription record, or deleting a old subscription record. At last, it returns the current status of the device to the subscriber. When the x10 controller detects the device status change, it notify the listener in the sip device control gateway. The listener calls OnNotify(), which checks the subscription records and send notification to the subscriber.

 

+-----------+            SUBSCRIBE            +--------------+

 |                  |  ---------------------------> |                       |

 |                  |                                              |                       |         x10 controller

 |                  |              200 with status         |  SIP Device   |          +---+

 |   sipc        |  <---------------------------- |  Control        + ----- +    +

 |                  |                                              |   Gateway     |           +---+

 |                  |              NOTIFY                 |                       |

 |                  |  <--------------------------- |                       |

 |                  |              200                          |                       |

 |                  |  ---------------------------> |                       |

+-----------+                                             +--------------+

Program Documentation

          int OnNotify(char *func, char hc, int unit)

          Description: Notify the subscriber. It gets all subscription records from the subscriptions.xml, analyzes it, then send notification to the related subscriber.

 

Measurements

We have test the sip gateway in muni.

Task List

Xu Li: Development and testing for sip gateway

References