×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    11

    SIP SUBSCRIBE problem

    Hi!

    I have problems sending SUBSCRIBE for presence..
    Following code is executed ok, but nothing is received at the server end. Can someone help me by pointing the problem?

    CSIPMessageElements* msgElem = CSIPMessageElements::NewL();
    CleanupStack::PushL( msgElem );

    //Get the current connection
    CSIPConnection& conn = ConnectionL();

    // Create user header array
    RPointerArray<CSIPHeaderBase>* userHeadersArr = new(ELeave)RPointerArray<CSIPHeaderBase>;
    CleanupStack::PushL( userHeadersArr );

    // Create Expires Header
    CSIPExpiresHeader* expiresHdr = new (ELeave)CSIPExpiresHeader(60);

    CleanupStack::PushL( expiresHdr );

    userHeadersArr->Append(expiresHdr);
    CleanupStack::Pop( expiresHdr );

    // Set the User Headers
    msgElem->SetUserHeadersL(*userHeadersArr);
    CleanupStack::Pop( userHeadersArr );

    //Create Event Header
    CSIPEventHeader* eventHdr = CSIPEventHeader::NewL(_L8("PRESENCE"));
    CleanupStack::PushL( eventHdr );
    userHeadersArr->Append(eventHdr);

    // create an object for refresh
    CSIPRefresh* iRefresh = CSIPRefresh::NewL();
    CleanupStack::PushL( iRefresh );

    //Getting sip username (AOR)
    const TDesC8* aor = NULL;
    iProfile->GetParameter( KSIPUserAor, aor );

    //Creating and setting "to" header
    CSIPAddress* toAddress =CSIPAddress:ecodeL(*aor);
    CleanupStack::PushL(toAddress);
    CSIPToHeader* toHeader = CSIPToHeader::NewL(toAddress);
    CleanupStack::Pop(toAddress);
    CleanupStack::PushL(toHeader);

    //Creating and setting "from" header
    CSIPAddress* addr = CSIPAddress:ecodeL( *aor );
    CleanupStack::PushL( addr );
    CSIPFromHeader* fromHeader = CSIPFromHeader::NewL( addr );
    CleanupStack::Pop( addr );
    CleanupStack::PushL(fromHeader);

    TBuf8<128> contact;
    _LIT8(kat,"@");
    _LIT8(klocal, "@LOCALHOST");
    TInt iNameEnd = aor->Find(kat);
    contact.Copy(aor->Ptr(), iNameEnd);
    contact.Append(klocal);
    CSIPContactHeader* contactHeader = CSIPContactHeader::NewL(CSIPAddress:ecodeL(contact));
    CleanupStack::PushL(contactHeader);

    CUri8* uri8 = ConvertToUri8LC( *aor );

    // create an object for CSIPSubscribeAssoc

    iSubscribeDialogAssoc = CSIPSubscribeDialogAssoc::NewL
    (conn, fromHeader, uri8, eventHdr, toHeader, contactHeader);

    CleanupStack::Pop( ); //uri 8

    CleanupStack::Pop( contactHeader );
    CleanupStack::Pop( fromHeader );
    CleanupStack::Pop( toHeader );

    delete iClientTx;
    TRAPD(err,iClientTx = iSubscribeDialogAssoc->SendSubscribeL
    (msgElem, iRefresh));

    if(err!=KErrNone)
    {

    User::Leave(err);
    }

    CleanupStack::Pop( iRefresh );

    CleanupStack::Pop( eventHdr );
    CleanupStack::Pop( msgElem );

    Thank you!
    Teemu

  2. #2
    Registered User
    Join Date
    Jul 2007
    Posts
    40

    Re: SIP SUBSCRIBE problem

    Hi Teemu!

    Can't see anything horrobly wrong with the code, so before checking it more carefully, please answer few questions.

    You say problem is "nothing is received at the server end". How you verified this? Have you checked using network sniffing tools (like ethereal/wireshark) that sip-stack really does not send anything to network? Before trying SUBSCRIBE, do you send REGISTER? Can you see that on sniffer? And finally, you have waited sip-connection to be active? And you are 100% sure that SendSubscribeL does not leave with errorcode?

    tkot

  3. #3
    Regular Contributor
    Join Date
    May 2007
    Posts
    468

    Re: SIP SUBSCRIBE problem

    There are be plenty of working SIP examples,
    maybe test if those work to see if there really is a problem in your code.

    Jack

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    282

    Re: SIP SUBSCRIBE problem

    Hi,

    Usually this problem may arise from not including the "loose routing" option on the to field. The symbian sip stack will then send the request to the resolved domain id rather then address you mentioned. I had a similar problem when doing sip register. May be you are facing the same problem with subscribe requests. Are you sure that your SIP Register command was completed successfully.

  5. #5
    Registered User
    Join Date
    Jan 2007
    Posts
    11

    Re: SIP SUBSCRIBE problem

    Hi!

    Thank you all very much for answering and sorry for little delay, but I was on vacations for few days..

    Yes, I am sending register before subscribe. And this registration is successful. I can see it from the SIP-settings of the device that I'm using.
    For various reasons I'm not able to run my program on emulator so I have to use it in real device. (For example, using ethernet in emulator seems to be pain in the ***).
    And actually only thing why I know that nothing is received is server side is because I'm observing log of my SIP server.
    In one of the versions I had debug messages that verified code reaching end of this function and not going to if(err!=KErrNone)
    {}.
    And yes, I tested that SIP connection is active before sending SUBSCRIBE.
    And yes, I have loose routing enabled in SIP-settings, if that's what vaibhavjain ment?

    BR, Teemu

Similar Threads

  1. SIP SUBSCRIBE PROBLEM
    By Olive in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2007-09-10, 11:34
  2. SIP NOTIFY Problem
    By Olive in forum VoIP
    Replies: 8
    Last Post: 2007-09-09, 11:06
  3. Problem using Nokia jsr180 RI with NIST JAIN SIP proxy
    By spozzi in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2007-03-15, 14:04
  4. SIP: BYE/ 481 (No Dialog Found)!!!!!!!!!!
    By Mini Pillai in forum Symbian Networking & Messaging (Closed)
    Replies: 13
    Last Post: 2007-02-09, 04:52
  5. SIP MESSAGE initResponse problem
    By badquek in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2007-01-24, 08:46

Posting Permissions

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