Group PJSIP_MSG_MSG

group PJSIP_MSG_MSG

SIP message (request and response) structure and operations.

Defines

PJSIP_MSG_CID_HDR(msg)

Find Call-ID header.

Parameters
  • msg – The message.

Returns

Call-ID header instance.

PJSIP_MSG_CSEQ_HDR(msg)

Find CSeq header.

Parameters
  • msg – The message.

Returns

CSeq header instance.

PJSIP_MSG_FROM_HDR(msg)

Find From header.

Parameters
  • msg – The message.

Returns

From header instance.

PJSIP_MSG_TO_HDR(msg)

Find To header.

Parameters
  • msg – The message.

Returns

To header instance.

Enums

enum pjsip_msg_type_e

Message type (request or response).

Values:

enumerator PJSIP_REQUEST_MSG

Indicates request message.

enumerator PJSIP_RESPONSE_MSG

Indicates response message.

Functions

pjsip_msg *pjsip_msg_create(pj_pool_t *pool, pjsip_msg_type_e type)

Create new request or response message.

Parameters
  • pool – The pool.

  • type – Message type.

Returns

New message, or THROW exception if failed.

pjsip_msg *pjsip_msg_clone(pj_pool_t *pool, const pjsip_msg *msg)

Perform a deep clone of a SIP message.

Parameters
  • pool – The pool for creating the new message.

  • msg – The message to be duplicated.

Returns

New message, which is duplicated from the original message.

void *pjsip_msg_find_hdr(const pjsip_msg *msg, pjsip_hdr_e type, const void *start)

Find a header in the message by the header type.

Parameters
  • msg – The message.

  • type – The header type to find.

  • start – The first header field where the search should begin. If NULL is specified, then the search will begin from the first header, otherwise the search will begin at the specified header.

Returns

The header field, or NULL if no header with the specified type is found.

void *pjsip_msg_find_hdr_by_name(const pjsip_msg *msg, const pj_str_t *name, const void *start)

Find a header in the message by its name.

Parameters
  • msg – The message.

  • name – The header name to find.

  • start – The first header field where the search should begin. If NULL is specified, then the search will begin from the first header, otherwise the search will begin at the specified header.

Returns

The header field, or NULL if no header with the specified type is found.

void *pjsip_msg_find_hdr_by_names(const pjsip_msg *msg, const pj_str_t *name, const pj_str_t *sname, const void *start)

Find a header in the message by its name and short name version.

Parameters
  • msg – The message.

  • name – The header name to find.

  • sname – The short name version of the header name.

  • start – The first header field where the search should begin. If NULL is specified, then the search will begin from the first header, otherwise the search will begin at the specified header.

Returns

The header field, or NULL if no header with the specified type is found.

void *pjsip_msg_find_remove_hdr(pjsip_msg *msg, pjsip_hdr_e hdr, void *start)

Find and remove a header in the message.

Parameters
  • msg – The message.

  • hdr – The header type to find.

  • start – The first header field where the search should begin, or NULL to search from the first header in the message.

Returns

The header field, or NULL if not found.

void pjsip_msg_add_hdr(pjsip_msg *msg, pjsip_hdr *hdr)

Add a header to the message, putting it last in the header list.

Bug:

Once the header is put in a list (or message), it can not be put in other list (or message). Otherwise Real Bad Thing will happen.

Parameters
  • msg – The message.

  • hdr – The header to add.

void pjsip_msg_insert_first_hdr(pjsip_msg *msg, pjsip_hdr *hdr)

Add header field to the message, putting it in the front of the header list.

Bug:

Once the header is put in a list (or message), it can not be put in other list (or message). Otherwise Real Bad Thing will happen.

Parameters
  • msg – The message.

  • hdr – The header to add.

pj_ssize_t pjsip_msg_print(const pjsip_msg *msg, char *buf, pj_size_t size)

Print the message to the specified buffer.

Parameters
  • msg – The message to print.

  • buf – The buffer

  • size – The size of the buffer.

Returns

The length of the printed characters (in bytes), or NEGATIVE value if the message is too large for the specified buffer.

struct pjsip_msg
#include <sip_msg.h>

This structure describes a SIP message.

Forward declaration for message (sip_msg.h).