×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 36
  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    2

    Any simple example using SIP Stack?

    Hello,

    Is there any simple example for using SIP Stack? or anyone want to show?
    Like Send Message or Audio via UDP Socket connection

    As I've seen from "Series 60 SIP Programmer's Guide", the example shows only Registration and Invitation. But how to continue for Sending Message?

    Sorry, I'm a novice in Symbian and SIP Stack!! T-T/~~

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    Have you checked the SIP plug-in package, I think when you download it , it comes with fully working example, showing most important functions.

    yucca

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    2
    The example comes with SIP Plug-in is only Columbus Game.
    It's too complicated for a beginner as I'm

    --------------------------------------------
    More question.
    How to use SDP API associate with SIP API? @-@??

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    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

  5. #5
    Regular Contributor
    Join Date
    Oct 2004
    Location
    India
    Posts
    138

    Hi query regarding seria; number

    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

  6. #6
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    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...

  7. #7
    Regular Contributor
    Join Date
    Oct 2004
    Location
    India
    Posts
    138

    got it, but one more problem

    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

    chaitu

  8. #8
    Regular Contributor
    Join Date
    Oct 2004
    Location
    India
    Posts
    138

    solved it.

    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?

    chaitu

  9. #9
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    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...

  10. #10
    Registered User
    Join Date
    Aug 2004
    Posts
    4

    Any simple example using SIP Stack?

    I've a simple SIP for sending INVITE and SUBSCRIBE message from one emulator to another. It works!

    This code may help you. I'm not an expert in SIP APIs and Symbian. : )

    ///////////////////////////////////////////CSIPEngine.cpp//////////////////////////////////////

    #include <SIPProfileRegistryObserver.h>
    #include <SIPObserver.h>
    #include <SIPConnectionObserver.h>
    #include <SIP.h>
    #include <SipProfileRegistry.h>
    #include <SipProfileRegistry.h>
    #include <SIPProfile.h>
    #include <SIPConnection.h>
    #include <SIPInviteDialogAssoc.h>
    #include <SIPFromHeader.h>
    #include <SIPToHeader.h>
    #include <SIPContactHeader.h>
    #include <SIPAddress.h>
    #include <SIPClientTransaction.h>
    #include <sipservertransaction.h>
    #include <sipdialog.h>
    #include <SIPResponseElements.h>
    #include <SIPRequestElements.h>
    #include <sipmessageelements.h>
    #include "CSIPEngine.h"

    CSIPEngine* CSIPEngine::NewL(TUid aUid) {
    CSIPEngine* self = new( ELeave ) CSIPEngine( aUid );
    CleanupStack::PushL( self ); self->ConstructL();
    CleanupStack::Pop();
    return self;
    }

    CSIPEngine::~CSIPEngine() {
    delete iSIP;
    delete iProfileRegistry ;
    delete iProfile;
    delete iConnection;
    delete iSIPClientTransaction;
    delete iSIPInviteDialogAssoc;
    delete iSIPSubscribeDialogAssoc;
    }

    void CSIPEngine::ExecuteL() {
    // Initialize SIP Stack
    iSIP = CSIP::NewL(iUid, *this);

    // Initialize ProfileRegistry
    iProfileRegistry = CSIPProfileRegistry::NewL(*iSIP, *this);

    // 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);

    CSIPToHeader* toHeader = CSIPToHeader::NewL(toAddress);

    CleanupStack::Pop(toAddress);
    CleanupStack::PushL(toHeader);

    // and construct CSIPInviteDialogAssoc by using
    // from- and toHeaders:
    CSIPInviteDialogAssoc* inviteDialogAssoc = CSIPInviteDialogAssoc::NewL( *iConnection, toHeader, *iProfile );

    CleanupStack::Pop(toHeader);
    // delete toAddress;
    //delete toHeader;

    return inviteDialogAssoc;
    }

    CSIPSubscribeDialogAssoc* CSIPEngine::CreateSIPSubscribeDialogAssoc(const TDesC8& user) {
    // Construct toHeader. Note that we use possibly non-existing
    // opponent SIP Address.
    CSIPAddress* toAddress = CSIPAddress:ecodeL(user);
    CleanupStack::PushL(toAddress);

    CSIPToHeader* toHeader = CSIPToHeader::NewL(toAddress);

    CleanupStack::Pop(toAddress);
    CleanupStack::PushL(toHeader);

    // and construct CSIPInviteDialogAssoc by using
    // from- and toHeaders:
    CSIPSubscribeDialogAssoc* subscribeDialogAssoc = CSIPSubscribeDialogAssoc::NewL( *iConnection, toHeader, *iProfile );

    CleanupStack::Pop(toHeader);
    // delete toAddress;
    //delete toHeader;

    return subscribeDialogAssoc;
    }

    //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.

    /*iSIPInviteDialogAssoc = CreateSIPInviteDialogAssoc();
    iSIPClientTransaction = iSIPInviteDialogAssoc->SendInviteL();
    */
    }
    }
    }

    // MSIPConnectionObserver implementation
    void CSIPEngine::IncomingResponse ( CSIPClientTransaction& aTransaction, CSIPDialogAssocBase& aDialogAssoc) {
    User::InfoPrint(_L("IncomingResponse"));

    // 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
    //...

    CSIPResponseElements* response;
    /*if (isAcceptableMedia) response= CSIPResponseElements::NewL(200, _L8("OK"));
    else response= CSIPResponseElements::NewL(405, _L8("Not Acceptable"));*/
    response= CSIPResponseElements::NewL(200, _L8("OK"));
    aTransaction->SendResponseL(response);
    }
    if (aTransaction->Type() == CSIPTransactionBase::ESUBSCRIBE) {
    CSIPResponseElements* response = CSIPResponseElements::NewL(200,_L8("OK"));
    CleanupStack::PushL(response);
    aTransaction->SendResponseL(response);
    CleanupStack::Pop(response);
    }
    delete aTransaction;
    }

    // MSIPConnectionObserver implementation.
    void CSIPEngine::IncomingRequest ( CSIPServerTransaction* aTransaction , CSIPDialog& aDialog) {
    // handle incoming request by using SIP API.
    // CSIPRequestElements reqElem = aTransaction->RequestElements()
    // …
    User::InfoPrint(_L("IncomingRequest"));
    if (aTransaction->Type() == CSIPTransactionBase::EACK)
    {
    if (aDialog.IsAssociated(*iSIPInviteDialogAssoc))
    {
    //INVITE succesful
    }
    }
    if (aTransaction->Type() == CSIPTransactionBase::EBYE)
    {
    //Buddy left
    }
    delete aTransaction;
    }
    Last edited by lolay; 2004-12-15 at 06:35.

  11. #11
    Registered User
    Join Date
    Aug 2004
    Posts
    4

    Any simple example using SIP Stack?

    ////////////////////////CSIPEngine.h//////////////////////////////////////////
    #ifndef CSIPENGINE_H
    #define CSIPENGINE_H

    #include <sipobserver.h>
    #include <sipprofileregistry.h>
    #include <sipprofileregistryobserver.h>
    #include <sipsubscribedialogassoc.h>
    #include <sipconnectionobserver.h>


    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:

    static CSIPEngine* NewL(TUid aUid);
    ~CSIPEngine();

    // MSIPProfileRegistryObserver implementation.
    // Move to cpp-file if further implementation.
    void ProfileCreated(TUint32 /*aSIPProfileId*/){}
    void ProfileUpdated(TUint32 /*aSIPProfileId*/){}
    void ProfileDestroyed(TUint32 /*aSIPProfileId*/){}
    void ProfileRegistryErrorOccurred( TUint32 /*aSIPProfileId*/,TInt /*aError*/){}
    void ProfileRegistrationStatusChanged(TUint32) ;

    // MSIPObserver implementation.
    // Move to cpp-file if further implementation.
    void IncomingRequest( TUint32 /*aIapId*/, CSIPServerTransaction* /*aTransaction*/){}
    virtual void TimedOut( CSIPServerTransaction& /*aSIPServerTransaction*/){}

    // MSIPConnectionObserver implementation.
    // Move to cpp-file if further implementation.
    void IncomingRequest ( CSIPServerTransaction* /*aTransaction*/, CSIPDialog& /*aDialog*/);
    void IncomingResponse ( CSIPClientTransaction& /*aTransaction*/){}
    void IncomingResponse ( CSIPClientTransaction& /*aTransaction*/, CSIPInviteDialogAssoc* /*aDialogAssoc*/){}
    void IncomingResponse ( CSIPClientTransaction& /*aTransaction*/, CSIPRegistration& /*aRegistration*/){}
    void ErrorOccured ( TInt /*aError*/, CSIPTransactionBase& /*aTransaction*/){}
    void ErrorOccured ( TInt /*aError*/, CSIPClientTransaction& /*aTransaction*/, CSIPRegistration& /*aRegistration*/){}
    void ErrorOccured ( TInt /*aError*/, CSIPTransactionBase& /*aTransaction*/, CSIPDialogAssocBase& /*aDialogAssoc*/){}
    void ErrorOccured ( TInt /*aError*/, CSIPRefresh& /*aSIPRefresh*/){}
    void ErrorOccured ( TInt /*aError*/, CSIPRegistration& /*aRegistration*/){}
    void ErrorOccured ( TInt /*aError*/, CSIPDialogAssocBase& /*aDialogAssoc*/){}
    void InviteCompleted ( CSIPClientTransaction& /*aTransaction*/){}
    void ConnectionStateChanged ( CSIPConnection::TState /*aState*/){}

    CSIPInviteDialogAssoc* CreateSIPInviteDialogAssoc(const TDesC8& user);
    CSIPSubscribeDialogAssoc* CreateSIPSubscribeDialogAssoc(const TDesC8& user);
    void ExecuteL();
    void Invite1();
    void Invite2();
    void Subscribe1();
    void Subscribe2();
    void IncomingResponse ( CSIPClientTransaction& , CSIPDialogAssocBase& ) ;
    // Move to cpp-file if further implementation.
    //void IncomingRequest ( CSIPServerTransaction* /*aTransaction*/, CSIPDialog& /*aDialog*/);
    void IncomingRequest ( CSIPServerTransaction* ) ;

    private:
    CSIPEngine(TUid& aUid) {
    iUid = aUid;
    }
    void ConstructL(){}
    TUid iUid;
    CSIP* iSIP;
    CSIPProfileRegistry* iProfileRegistry;
    CSIPProfile* iProfile;
    CSIPConnection* iConnection;
    CSIPClientTransaction* iSIPClientTransaction;
    CSIPInviteDialogAssoc* iSIPInviteDialogAssoc;
    CSIPSubscribeDialogAssoc* iSIPSubscribeDialogAssoc;

    };

    #endif // #ifndef CSIPEngine_H

    Note

  12. #12
    Regular Contributor
    Join Date
    Oct 2004
    Location
    India
    Posts
    138

    small doubt regarding the program

    what does the folloing line in your program do..

    it is "ProfileRegistrationStatusChanged" function of CSIPEngine:

    iConnection = iProfileRegistry->ConnectionL(*iProfile);

    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?

    chaitu

  13. #13
    Regular Contributor
    Join Date
    Oct 2004
    Location
    India
    Posts
    138

    I am still waiting for a reply.....

    Hi,
    i tried to explore the reason for the problem,
    can anybody help

    chaitu

  14. #14
    Registered User
    Join Date
    Dec 2004
    Posts
    8

    how make it work...

    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..

  15. #15
    Registered User
    Join Date
    Aug 2004
    Posts
    4
    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.

    iConnection = iProfileRegistry->ConnectionL(*iProfile);

    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.

    http://mcl.ce.kmitl.ac.th/~note/SIP/pages/index.htm


    To val_kilmer,

    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

    Hope it may help you,

    Note ^-^

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×