Group PJSIP_ISCOMPOSING

group PJSIP_ISCOMPOSING

Support for Indication of Message Composition (RFC 3994)

This implements message composition indication, as described in RFC 3994.

Functions

PJ_BEGIN_DECL pj_xml_node * pjsip_iscomposing_create_xml (pj_pool_t *pool, pj_bool_t is_composing, const pj_time_val *lst_actv, const pj_str_t *content_tp, int refresh)

Create XML message with MIME type “application/im-iscomposing+xml” to indicate the message composition status.

Parameters
  • pool – Pool to allocate memory.

  • is_composing – Message composition indication status. Set to PJ_TRUE (or non-zero) to indicate that application is currently composing an instant message.

  • lst_actv – Optional attribute to indicate time of last activity. If none is to be specified, the value MUST be set to NULL.

  • content_tp – Optional attribute to indicate the content type of message being composed. If none is to be specified, the value MUST be set to NULL.

  • refresh – Optional attribute to indicate the interval when next indication will be sent, only when is_composing is non-zero. If none is to be specified, the value MUST be set to -1.

Returns

An XML message containing the message indication. NULL will be returned when there’s not enough memory to allocate the message.

pjsip_msg_body *pjsip_iscomposing_create_body(pj_pool_t *pool, pj_bool_t is_composing, const pj_time_val *lst_actv, const pj_str_t *content_tp, int refresh)

Create message body with Content-Type “application/im-iscomposing+xml” to indicate the message composition status.

Parameters
  • pool – Pool to allocate memory.

  • is_composing – Message composition indication status. Set to PJ_TRUE (or non-zero) to indicate that application is currently composing an instant message.

  • lst_actv – Optional attribute to indicate time of last activity. If none is to be specified, the value MUST be set to NULL.

  • content_tp – Optional attribute to indicate the content type of message being composed. If none is to be specified, the value MUST be set to NULL.

  • refresh – Optional attribute to indicate the interval when next indication will be sent, only when is_composing is non-zero. If none is to be specified, the value MUST be set to -1.

Returns

The SIP message body containing XML message indication. NULL will be returned when there’s not enough memory to allocate the message.

pj_status_t pjsip_iscomposing_parse(pj_pool_t *pool, char *msg, pj_size_t len, pj_bool_t *p_is_composing, pj_str_t **p_last_active, pj_str_t **p_content_type, int *p_refresh)

Parse the buffer and return message composition indication in the message.

Parameters
  • pool – Pool to allocate memory for the parsing process.

  • msg – The message to be parsed.

  • len – Length of the message.

  • p_is_composing – Optional pointer to receive iscomposing status.

  • p_last_active – Optional pointer to receive last active attribute.

  • p_content_type – Optional pointer to receive content type attribute.

  • p_refresh – Optional pointer to receive refresh time.

Returns

PJ_SUCCESS if message can be successfully parsed.