Saturday, September 13, 2014

Using JAIN SIP for Android part II

How to register android SIP stack with a server

In this post we are going to register a sip stack with a server, using the JAIN SIP library from previous tutorial . Before a client can start communication with a server it has to indicate its current IP address and the URLs for which it would like to receive calls and messages.

We are going to need to do the following in order to register the stack
  1. Initialize the stack
  2. Send Register packet
  3. Send authentication information

Step -1: Initialize the Stack

Lets start by setting up a new android project in ADT eclipse, create a new blank Activity during the wizard. Lets create a singleton class SipStackAndroid and initialize a SIP stack. This class is going to implement SipListener and corresponding methods to process SIP events.

Step -2: Send REGISTER

The following method sends a Register packet to server.

Step -3: Send authentication information

In response to the REGISTER packet, server asks for authentication information. Which will be received in processResponse() method. The code snippet below sends back authentication to server.
Helper classes like AccountManagerImpl can be found in JAIN-SIP examples.

In the next post we are going to make a basic android SIP messenger which will be able to receive/send SIP MESSAGE.

No comments:

Post a Comment