This tutorial shows you how to use SIP to create a peer-to-peer connection
by sending an INVITE
, and then terminating it with a BYE
(see
chapter SIP request
methods for more information). In order to do so, a pair of example MIDlet
s
are used. With the help of this tutorial, you can build the example from scratch
and familiarize yourself with some common features related to SIP. Alternatively,
you can download the example files and run them immediately with your S60
SDK (3rd Edition or later). For more information on importing, building, and
running Java projects, see chapter Creating
the project environment. The example applications are called OriginatingInvite
and TerminatingInvite
. They aim to demonstrate the functionality of SIP INVITE/ACK/BYE
sessions.
Note: The process described in this developer guideis only one method of constructing a SIP session using the INVITE/ACK/BYE methods. You can choose to use only parts of this example or build your own version completely from scratch if you wish.
There are two ways for a user to register with a SIP server. One way is to configure the SDK or the device's sip setting, and create the default SIP profile, the MIDlet running on this SDK or device can use this default profile without sending registrar request again. The other way is to send a registrar request in each MIDlet to be registered in the SIP server. See the SIP API for JavaTM 2 Micro Edition (JSR 180): Implementation Notes for more information.
Note: These examples require the user to create a default profile on the SDK or device, and public user names are "sip:sip1@sipServer" and "sip:sip2@sipServer".
OriginatingInvite MIDlet runs on the SDK with the user name sip1, and TerminatingInvite MIDlets runs on the SDK or device with the user name sip2.
Public user name and the "From""To""Contact" SIP header in the MIDlets needs to be matched for the sip instant messaging and invite to work. Modifications to the source and sip profile needs to be done accordingly, if you decide not to use the default sip public user name provided here. The example GUIs shown below have used such a modified profile, in this case sip1 has been replaced with "bob".
Example functionality description:
The OriginatingInvite
and TerminatingInvite
are
started in separate emulators, which should run in separate hosts.
In OriginatingInvite
MIDlet
the
‘Address’ field and the target address are specified and ‘Start’ is selected.
If the session set-up is successful the correct text logs appear on the screens.
Note: The SDP content delivered in the INVITE
and 200
OK messages is not relevant for the operation of this example application.
It is just there as an example.
Selecting "Hang-up" on either end ends the session. The request BYE
is
sent and the other party responds with (200) OK.