# &adminguide;

## Overview

The PUA_JSON module adds support to publish updates to the presence module through the pua_json_publish() function.

From a high-level perspective, the module may be used for:

- Providing a real-time presence updates.

## How it works

The module parses json data objects and inserts them into the presentity table for real-time presence updates.

## Dependencies

### &kamailio; Modules

The following modules must be loaded before this module:

- none.

### External Libraries or Applications

The following libraries or applications must be installed

- libjson.

## Functions

### `pua_json_publish(json_payload)`

The function build presentity state from json_payload and updates presentity table.

Usage: presence related.

This function can be used from ANY ROUTE.

#### `pua_json_publish` usage

    ...
    event_route[xhttp:request] {
    	$var(call-id) = $(rb{json.parse,Call-ID});
    	if ($(rb{json.parse,Event-Package}) == "dialog") {
    		xlog("L_INFO", "$var(call-id)|log|received $(rb{json.parse,Event-Package}) update for $(rb{json.parse,From})");
    		pua_json_publish($rb);
    	}
    }
    ...