Group PJSIP_TIMER

group PJSIP_TIMER

SIP Session Timers support (RFC 4028 - Session Timers in SIP)

References

References:

Typedefs

typedef struct pjsip_timer pjsip_timer

Opaque declaration of Session Timers.

Functions

pj_status_t pjsip_timer_init_module(pjsip_endpoint *endpt)

Initialize Session Timers module. This function must be called once during application initialization, to register this module to SIP endpoint.

Parameters:

endpt – The SIP endpoint instance.

Returns:

PJ_SUCCESS if module is successfully initialized.

pj_status_t pjsip_timer_setting_default(pjsip_timer_setting *setting)

Initialize Session Timers setting with default values.

Parameters:

setting – Session Timers setting to be initialized.

Returns:

PJ_SUCCESS on successful.

pj_status_t pjsip_timer_init_session(pjsip_inv_session *inv, const pjsip_timer_setting *setting)

Initialize Session Timers for an invite session. This function should be called by application to apply Session Timers setting, otherwise invite session will apply default setting to the Session Timers.

Parameters:
  • inv – The invite session.

  • setting – Session Timers setting, see pjsip_timer_setting. If setting is NULL, default setting will be applied.

Returns:

PJ_SUCCESS on successful.

pjsip_sess_expires_hdr *pjsip_sess_expires_hdr_create(pj_pool_t *pool)

Create Session-Expires header.

Parameters:

pool – Pool to allocate the header instance from.

Returns:

An empty Session-Expires header instance.

pjsip_min_se_hdr *pjsip_min_se_hdr_create(pj_pool_t *pool)

Create Min-SE header.

Parameters:

pool – Pool to allocate the header instance from.

Returns:

An empty Min-SE header instance.

pj_status_t pjsip_timer_update_req(pjsip_inv_session *inv, pjsip_tx_data *tdata)

Update outgoing request to insert Session Timers headers and also signal Session Timers capability in Supported and/or Require headers.

This function will be called internally by the invite session if it detects that the session needs Session Timers support.

Parameters:
  • inv – The invite session.

  • tdata – Outgoing INVITE or UPDATE request.

Returns:

PJ_SUCCESS on successful.

pj_status_t pjsip_timer_process_resp(pjsip_inv_session *inv, const pjsip_rx_data *rdata, pjsip_status_code *st_code)

Process Session Timers headers in incoming response, this function will only process incoming response with status code 422 (Session Interval Too Small) or 2xx (final response).

This function will be called internally by the invite session if it detects that the session needs Session Timers support.

Parameters:
  • inv – The invite session.

  • rdata – Incoming response data.

  • st_code – Output buffer to store corresponding SIP status code when function returning non-PJ_SUCCESS.

Returns:

PJ_SUCCESS on successful.

pj_status_t pjsip_timer_handle_refresh_error(pjsip_inv_session *inv, pjsip_event *event)

Process Session Timers refresh error, this function will process error from refresh request. The error will be handle according the error code, i.e : BYE will be sent after error 503 (Transport Error).

Parameters:
  • inv – The invite session.

  • event – The event that trigger the error.

Returns:

PJ_SUCCESS on successful.

pj_status_t pjsip_timer_process_req(pjsip_inv_session *inv, const pjsip_rx_data *rdata, pjsip_status_code *st_code)

Process Session Timers headers in incoming request, this function will only process incoming INVITE and UPDATE request.

This function will be called internally by the invite session if it detects that the session needs Session Timers support.

Parameters:
  • inv – The invite session.

  • rdata – Incoming INVITE or UPDATE request.

  • st_code – Output buffer to store corresponding SIP status code when function returning non-PJ_SUCCESS.

Returns:

PJ_SUCCESS on successful.

pj_status_t pjsip_timer_update_resp(pjsip_inv_session *inv, pjsip_tx_data *tdata)

Update outgoing response to insert Session Timers headers and also signal Session Timers capability in Supported and/or Require headers. This function will only update outgoing response with status code 422 (Session Interval Too Small) or 2xx (final response).

This function will be called internally by the invite session if it detects that the session needs Session Timers support.

Parameters:
  • inv – The invite session.

  • tdata – Outgoing 422/2xx response.

Returns:

PJ_SUCCESS on successful.

pj_status_t pjsip_timer_end_session(pjsip_inv_session *inv)

End Session Timers in an invite session.

This function will be called internally by the invite session if it detects that the session needs Session Timers support.

Parameters:

inv – The invite session.

Returns:

PJ_SUCCESS on successful.

struct pjsip_timer_setting
#include <sip_timer.h>

This structure describes Session Timers settings in an invite session.

Public Members

unsigned min_se

Specify minimum session expiration period, in seconds. Must not be lower than 90. Default is 90.

unsigned sess_expires

Specify session expiration period, in seconds. Must not be lower than min_se. Default is 1800.

struct pjsip_sess_expires_hdr
#include <sip_timer.h>

SIP Session-Expires header (RFC 4028).

Public Functions

PJSIP_DECL_HDR_MEMBER(struct pjsip_sess_expires_hdr)

Standard header field.

Public Members

unsigned sess_expires

Session expiration period

pj_str_t refresher

Refresher

pjsip_param other_param

Other parameters

struct pjsip_min_se_hdr
#include <sip_timer.h>

SIP Min-SE header (RFC 4028).

Public Functions

PJSIP_DECL_HDR_MEMBER(struct pjsip_min_se_hdr)

Standard header field.

Public Members

unsigned min_se

Minimum session expiration period

pjsip_param other_param

Other parameters