×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    38

    How to Send SIP Publish Message

    How do you send a simple compliant Publish message using the Nokia SIP Plugin?

    I see the classes CSIPSubscribeDialogAssoc and CSIPSubscribeHeaderState but I do not see anything Publish related.

    Thanks in advance,
    Rob.

  2. #2
    Registered User
    Join Date
    Nov 2004
    Posts
    38

    How to Send a SIP Publish Message

    After some looking, it appears I need to construct a CSIPRequestElements object, set it's headers including the method header(PUBLISH) and use CSIPConnection::sendRequestL().

    However, a publish message also contains a presence document in the form of XML content. Content may only be added to CSIPMessageElements object. I'm trying to determine how to send and build a SIP message which contains elements of both CSIPMessageElements and CSIPRequestElements (a PUBLISH message)?

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    38

    Here's How

    Instantiate CSIPRequestElements and set the method to PUBLISH.

    Retrieve the CSIPMessageElements from the CSIPRequestElements via the MessageElements() method.

    Obtain the CSIPMessageElements RPointerArray member via the UserHeaders() method and insert the headers.

  4. #4
    Registered User
    Join Date
    Nov 2004
    Posts
    38

    CSIPMessageElements::SetUserHeadersL(*userHeadersArr); crashes

    I instantiate a user headers array like so

    RPointerArray<CSIPHeaderBase>* userHeadersArr = new(ELeave)RPointerArray<CSIPHeaderBase>;

    I then create and append the following user headers to the array...

    CSIPCSeqHeader, CSIPExpiresHeader however when I call SetUserHeadersL() I receive access violation. I'm able to call SetContentL successfully and the payload appears in the message.

    The documentation for CSIPRequestElements::MessageElements states;

    Gets message elements (contains all SIP user headers and content) The response elements can be populated with SIP user headers and content using returned reference to the message elements.

    I must not be meeting some pre-condition but I'm not sure what that can be

    If I retrieve rather than create the User headers array via the CSIPMessageElements::UserHeaders() method and append the headers the values do not take affect in the message.

    C'mon Seniors...

    Thanks,
    RE

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    11
    u can use following code to send publish:

    void CSIPExample:ublish(TDesC& status)
    {

    //get aor from the profile

    const CDesC8Array& aor= (CDesC8Array&) iProfile->AORs();
    TPtrC8 a=aor[0];

    // TBuf<64> add;
    // add.Copy(a);
    // User::InfoPrint(add);


    // CSIPAddress* toAddress =CSIPAddress:ecodeL(_L8("sip:shivam@telisoft.com"));

    CSIPAddress* toAddress =CSIPAddress:ecodeL(a);
    CleanupStack::PushL(toAddress);

    CSIPToHeader* toHeader = CSIPToHeader::NewL(toAddress);
    CleanupStack::Pop(toAddress);
    CleanupStack::PushL(toHeader);

    CSIPRequestElements* reqElems = CSIPRequestElements::NewL(toHeader);
    CSIPMessageElements& MessageElements1=reqElems->MessageElements();

    TBuf8<512> doc;

    _LIT8(kdoc1,"<?xml version=\"1.0\" encoding=\"UTF-8\"?><presence xmlns=\"urn:ietfarams:xml:nsidf\" entity=\"");
    _LIT8(kdoc2,"\"><tuple id=\"tup1\" ><status><basic>open</basic></status><note>");
    _LIT8(kdoc3,"</note></tuple></presence>"); //presence document

    doc.Copy(kdoc1);
    doc.Append(a);
    doc.Append(kdoc2);
    doc.Append(status);
    doc.Append(kdoc3);

    MessageElements1.SetContentL(doc.AllocL(),CSIPContentTypeHeader::NewL(_L8("application"),_L8("pidf+xml")));

    RPointerArray <CSIPHeaderBase> myheader1(1);

    CSIPEventHeader* EventHeader1=CSIPEventHeader::NewL ( _L8("presence"));
    myheader1.Append(EventHeader1);

    MessageElements1.SetUserHeadersL(myheader1);


    //reqElems->SetToHeaderL(toHeader);
    CleanupStack::Pop(); //toHeader

    // CleanupStack::PushL(reqElems);
    reqElems->SetMethodL(_L8("PUBLISH"));
    // CleanupStack::Pop(); //reqElems



    iSIPClientTransaction = iConnection->SendRequestL(reqElems,*iProfile);

    }

    bye

    NITIN

Posting Permissions

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