Generic abstraction to message body. When an incoming message is parsed (pjsip_parse_msg()), the parser fills in all members with the appropriate value. The 'data' and 'len' member will describe portion of incoming packet which denotes the message body. When application needs to attach message body to outgoing SIP message, it must fill in all members of this structure.
Forward declaration for message body (sip_msg.h).
MIME content type. For incoming messages, the parser will fill in this member with the content type found in Content-Type header.
For outgoing messages, application may fill in this member with appropriate value, because the stack will generate Content-Type header based on the value specified here.
If the content_type is empty, no Content-Type AND Content-Length header will be added to the message. The stack assumes that application adds these headers themselves.
void* pjsip_msg_body::data |
Pointer to buffer which holds the message body data. For incoming messages, the parser will fill in this member with the pointer to the body string.
When sending outgoing message, this member doesn't need to point to the actual message body string. It can be assigned with arbitrary pointer, because the value will only need to be understood by the print_body() function. The stack itself will not try to interpret this value, but instead will always call the print_body() whenever it needs to get the actual body string.