< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate-users] how to parse sip frag


hi, all

I got following sip message for refer response, so I want parse the sipfrag

[14:51:36]                      onSubScriptionTerminated


NOTIFY sip:87654321@xxxxxxxxxxxxxx:5061 SIP/2.0

Via: SIP/2.0/UDP 202.79.217.251:5060;branch=z9hG4bK0015172A039A072EF526F12F86E8

Max-Forwards: 70

Contact: <sip:202.79.217.251:5060>

To: <sip:87654321@xxxxxxxxxxxxxx>;tag=51dcb074

From: "unknown"<sip:203.125.84.22>;tag=0lmxNIAFv20004jR0001u000Y7X4XBDC8

Call-ID: 9a2a15000317-4a6415b6-7cdfe6ee-1f6bb380-9e@xxxxxxxxx

CSeq: 46524 NOTIFY

Content-Type: message/sipfrag

Subscription-State: terminated;expires=60;reason=noresource

Event: refer

Content-Length: 24


SIP/2.0 404 Not Found




my source code for parse sip frag like this:

//subscription can be ended through a notify or a failure response.
void TSipAccount::onTerminated(ClientSubscriptionHandle h, const SipMessage* msg)
{
      
    if (msg != NULL && msg->exists(resip::h_Event) && msg->header(resip::h_Event).value() == "refer")
    {
        const Mime sipfrag_t("message", "sipfrag");
        int reason = 0;
        if (msg->exists(resip::h_ContentType) && msg->header(resip::h_ContentType) == sipfrag_t)
        {
            SipFrag frag(msg->getContents()->getBodyData(), msg->header(resip::h_ContentType));
            const SipMessage &fmsg = frag.message();
            if (!fmsg.isRequest())
            {
                reason = fmsg.header(h_StatusLine).statusCode();
  
            }
        }
       }
}


this compile is ok, but got link error, I found the constructor of SipFrag I used declared in SipFrag.hxx, but not implemented in SipFrag.cxx

so can anybody help to find out how to parse sipfrag?

--
Best Regards

Maodong Hu