group PJSUA_UA

Provides dialog management.

Application MUST initialize the user agent layer module by calling pjsip_ua_init_module() before using any of the dialog API, and link the application with with pjsip-core library.


pj_status_t pjsip_ua_init_module(pjsip_endpoint *endpt, const pjsip_ua_init_param *prm)

Initialize user agent layer and register it to the specified endpoint.

  • endpt – The endpoint where the user agent will be registered.

  • prm – UA initialization parameter.


PJ_SUCCESS on success.

pjsip_user_agent *pjsip_ua_instance(void)

Get the instance of the user agent.


The user agent module instance.

pj_uint32_t pjsip_ua_get_dlg_set_count(void)

Retrieve the current number of dialog-set currently registered in the hash table. Note that dialog-set is different than dialog when the request forks. In this case, all dialogs created from the original request will belong to the same dialog set. When no forking occurs, the number of dialog sets will be equal to the number of dialogs.


Number of dialog sets.

pjsip_dialog *pjsip_ua_find_dialog(const pj_str_t *call_id, const pj_str_t *local_tag, const pj_str_t *remote_tag, pj_bool_t lock_dialog)

Find a dialog with the specified Call-ID and tags properties. This function may optionally lock the matching dialog instance before returning it back to the caller.

  • call_id – The call ID to be matched.

  • local_tag – The local tag to be matched.

  • remote_tag – The remote tag to be matched.

  • lock_dialog – If non-zero, instruct the function to lock the matching dialog with pjsip_dlg_inc_lock(). Application is responsible to release the dialog’s lock after it has finished manipulating the dialog, by calling pjsip_dlg_dec_lock().


The matching dialog instance, or NULL if no matching dialog is found.

pj_status_t pjsip_ua_destroy(void)

Destroy the user agent layer.


PJ_SUCCESS on success.

void pjsip_ua_dump(pj_bool_t detail)

Dump user agent contents (e.g. all dialogs).


detail – If non-zero, list of dialogs will be printed.

pjsip_endpoint *pjsip_ua_get_endpt(pjsip_user_agent *ua)

Get the endpoint instance of a user agent module.


ua – The user agent instance.


The endpoint instance where the user agent is registered.

struct pjsip_ua_init_param
#include <sip_ua_layer.h>

User agent initialization parameter.

Public Members

pjsip_dialog *(*on_dlg_forked)(pjsip_dialog *first_set, pjsip_rx_data *res)

Callback to be called when the UA layer detects that outgoing dialog has forked.