I'm afraid that you cannot find a "simple" example how to work with SIP stack. I really thing that looking into the "warship" game is the best way how to learn the stuff. For example run the game in debug mode and follow the code...
Also in these 4 documents that describes the sip stack are some code snippets that can be helpful:
SIP Client API Specification v1.0
SDP Codec API Specification v1.0
SIP Codec API Specification v1.0
SIP Profile API Specification v1.0
Hi all, any of you guys have a serial number for sip-pugin for series60 2.0 sdk,
because i am having a problemin getting the serial number from nokia.
Thanks in advance
chaitu
During installation process you can enter your Forum Nokia account and they will send the serial number directly to your e-mail. It is an automated process and you should get the number few minutes after you ask for it...
Ya thanks, sopta
i have installed the SIP plug-in, and also the battle ship example.
i have made the SIP settings as per the PDF file that comes with the SIP pug-in set up, and tried to execute the battle ship game.
The problem is the application is giving an "Registration failed".
In the Emulator server logs, it is failling after the "Max forwards" count reaches 0 (from 70).
i searched the forum and did the following things.
1. re-installed jdk
but of no use.
can you throw some light on what might be the problem
i have solved the problem,
the mistake i did is i have not added the IP address as the domain(forgot creating a new domain).
after the domain is created it is working fine.
but the warships example is not so roboust to errors.
the application crashes lot many times.
donno y?
I don't remember any crashes, but generally the example applications that are present in SDK are not so robust because they are trying to be as simple as possible. It is necessary to show some aspects of the platfom and when you try to reuse them you should be very careful and check all possible error cases...
// Get the default profile.
iProfile = iProfileRegistry->DefaultProfileL();
// The client asks the API to enable the retrieved profile for its use.
// For that, the client must inherit and implement MSIPConnectionObserver.
TInt status = iProfileRegistry->EnableL(*iProfile, *this);
// The returned status indicates if the profile can be immediately used
// for creating a session, or if the client must wait for the profile to
// be registered.
if (status == KErrNone) {
// get the SIP connection used by the profile
iConnection = iProfileRegistry->ConnectionL(*iProfile);
} else
// KErrPending
{
// wait for the profile to be registered before using it further
}
// Next look at
// ProfileRegistrationStatusChanged(TUint32 aSIPProfileId)
// method. Response for REGISTER request is handled there.
}
// End ExecuteL
void CSIPEngine::Invite1() {
// create a SIP dialog for sending an INVITE;
iSIPInviteDialogAssoc = CreateSIPInviteDialogAssoc(_L8("siplayer1@10.0.0.1"));
// Continue session establishement using the SIP Client API
iSIPClientTransaction = iSIPInviteDialogAssoc->SendInviteL();
}
// End Invite
void CSIPEngine::Invite2() {
// create a SIP dialog for sending an INVITE;
iSIPInviteDialogAssoc = CreateSIPInviteDialogAssoc(_L8("siplayer2@10.0.0.1"));
// Continue session establishement using the SIP Client API
iSIPClientTransaction = iSIPInviteDialogAssoc->SendInviteL();
}
// End Invite
void CSIPEngine::Subscribe1() {
// create a SIP dialog for sending an INVITE;
iSIPSubscribeDialogAssoc = CreateSIPSubscribeDialogAssoc(_L8("siplayer1@10.0.0.1"));
// Continue session establishement using the SIP Client API
iSIPClientTransaction = iSIPSubscribeDialogAssoc->SendSubscribeL();
}
// End Subscribe
void CSIPEngine::Subscribe2() {
// create a SIP dialog for sending an INVITE;
iSIPSubscribeDialogAssoc = CreateSIPSubscribeDialogAssoc(_L8("siplayer2@10.0.0.1"));
// Continue session establishement using the SIP Client API
iSIPClientTransaction = iSIPSubscribeDialogAssoc->SendSubscribeL();
}
// End Subscribe
/***********************************************************************
/** * Constructs CSIPInviteDialogAssoc object for test purposes.
* @return CSIPInviteDialogAssoc object
************************************************************************/
CSIPInviteDialogAssoc* CSIPEngine::CreateSIPInviteDialogAssoc(const TDesC8& user) {
// Construct toHeader. Note that we use possibly non-existing
// opponent SIP Address.
CSIPAddress* toAddress = CSIPAddress:ecodeL(user);
CleanupStack::PushL(toAddress);
// and construct CSIPInviteDialogAssoc by using
// from- and toHeaders:
CSIPInviteDialogAssoc* inviteDialogAssoc = CSIPInviteDialogAssoc::NewL( *iConnection, toHeader, *iProfile );
// and construct CSIPInviteDialogAssoc by using
// from- and toHeaders:
CSIPSubscribeDialogAssoc* subscribeDialogAssoc = CSIPSubscribeDialogAssoc::NewL( *iConnection, toHeader, *iProfile );
//MSIPProfileRegistryObserver implementation:
void CSIPEngine::ProfileRegistrationStatusChanged(TUint32 aSIPProfileId) {
// First inform User Interface that this method is being called
User::InfoPrint(_L("ProfileRegistrationStatusChanged"));
// Check that the changed profile is the same we use
if (aSIPProfileId == iProfile->Id()) {
// Check that registration to the server was successful
if ( iProfile->Status() == CSIPProfile::ERegistered) {
// Get a connection object from ProfileRegistry.
// Note: this can only be done after successful
// registration.
iConnection = iProfileRegistry->ConnectionL(*iProfile);
// Continue this example application directly by
// sending INVITE request.
// ACK is sent to any 2xx response
if (aTransaction.ResponseElements()->StatusCode() >= 200 && aTransaction.ResponseElements()->StatusCode() < 300) {
// Send ACK message:
iSIPInviteDialogAssoc->SendAckL(aTransaction);
}
}
// MSIPConnectionObserver implementation.
//Gets called when an INVITE comes
void CSIPEngine::IncomingRequest (CSIPServerTransaction* aTransaction)
{
User::InfoPrint(_L("IncomingRequest"));
if (aTransaction->Type() == CSIPTransactionBase::EINVITE)
{
//Answer immediately with 180 Ringing
//THE NEXT LINE IS VERY IMPORTANT AND ALMOST NOWHERE DOCUMENTED!!
iSIPInviteDialogAssoc=CSIPInviteDialogAssoc::NewL(*aTransaction);
CSIPResponseElements* responseRinging;
responseRinging= CSIPResponseElements::NewL(180, _L8("Ringing"));
aTransaction->SendResponseL(responseRinging);
//Now handle the request correctly
TBuf8<100> *senderAddr=new TBuf8<100>;
const CSIPRequestElements *reqElem = aTransaction->RequestElements();
const CSIPMessageElements& cSIPMessageElements=reqElem->MessageElements();
//...
//If you want to read SDP data, you can do it here
//but as I can see you do not use it yet
//let isAcceptableMedia store whether you want to accept the INVITE
//...
class CSIPProfileRegistryObserver;
class CSIPObserver;
class CSIPConnectionObserver;
class CSIP;
class CSipProfileRegistry;
class CSIPProfile;
class CSIPConnection;
class CSIPInviteDialogAssoc;
class CSIPFromHeader;
class CSIPToHeader;
class CSIPContactHeader;
class CSIPAddress;
class CSIPClientTransaction;
class CSIPResponseElements;
class CSIPRequestElements;
class CSIPServerTransaction;
class CSIPInviteDialogAssoc;
class CSIPEngine :
public CBase,
public MSIPProfileRegistryObserver,
public MSIPObserver,
public MSIPConnectionObserver
{
public:
because i am haveing poblem in running the program,
i use vc++ ide, when i debugged the program, the control comes to this statement and stops and waits...nothing happens.
what are pre condns for this function to be success ful,
one condn will be the second person should be registered with the SIP server,any more?
Hi Lolay ,
Thank for giving the code!, I had the similar kind of code, which i coded. i am here is the piece of code...
//instantiating the CSIPEngine///////
iPlayer1Engine= CSIPEngine::NewL(Application()->AppDllUid());
////calling for REGISTRATION/////////
iPlayer1Engine->ExecuteL();
//// INVITing the other emulator////////////////
iPlayer1Engine->Invite2();
and i just followed thr procedure given for the "CHIPFLIP" app.
i.e i just copied the EPOC on to the player2 with all proper settings.
I tried to Debug it, it's fine with REGISTER, but for INVITE it's giving 603 Decline.
i have been working on it for last 10 day.
I need your help on it.
plz try to reply..
thanks in advance..
Hi all,
I'm very sorry for replying late.
I have been trying to login and waiting for a long time.
I tried to post the answer but I can't.
I don't know why.
To chaitu,
///////////////////////////////////////
ProfileRegistrationStatusChanged function
Indicates that the registration status of a SIP profile has been changed.
This event is sent to those observers who have the corresponding profile instantiated.
gets the SIP connection to be used with a given SIP profile.
The ownership of the returned connection is transferred to the caller.
Note that the returned instance is not always new.
If a connection for the same IAP has already been instantiated,
the instance corresponding to that connection is returned here. It is the responsibility of the client to delete instances correctly.
/////////////////////////////////////////
I copied this from SIP Profile API Specification.
Codes above I applied from SIP Example in SIP Programmer's Guide.
You should setup environment follow up SIP Programmer's Guide and SIP User's Guide to running the program.
and see a sequence of this program from my Website.
I think because Epoc can't get all the standalone SIP requests received from network.
You should solve by using ClientInstaller it is possible to route incoming SIP messages to a correct application
in a terminal. ClientInstaller is used by adding three lines to the SIP application pkg file.
One more configuration file (SipAppCapabilities.xml) is required ,too.
To let your app start when the recipient emulator gets a SIP message,
SipAppCapabilities.xml must be put to ...\epoc32\wins\c, then SIPCLIENTINSTALLER.EXE must be started
You can see the examples of the pkg and xml files in SIP Programmer's Guide