Skip to main content

Brew

Brew

TETRA Homebrew Protocol

Protocol is based on WebSocket version 13 (RFC 6455) without extensions. It's highly recommended to use socket options TCP_NODELAY and TCP_QUICKACK.

Endpoint, authentication

To establish a new connection client should make a HTTP GET call to get web socket's endpoint and pass authentication procedure. Authentication is based on HTTP Digest Access Authentication (RFC 2831). As a result of successful authentication server returns HTTP 200 and a URI to an endpoint to be used for WebSocket connection.

GET /brew/ HTTP/1.1


HTTP/1.1 200 OK

/brew/722e2b04-07ad-4976-ac55-75e845ae4d8a

Server supports following response codes: 101, 200, 401, 403, 404, 429, 500.

WebSocket transport layer

Client should support following frame opcodes:

  • Close, ping, pong. Ping and pong messages might contain a payload to measure delays.
  • Single-frame masked and unmasked binary messages. Server always send unmasked messages, client may send masked messages.

Binary messages

Every message contains two-byte prefix:

  1. Message class
  2. Message type

All following data has non-aligned values in Little-Endian order

Mobility and affiliation (message class 0xf0)

TBD

Call control (message class 0xf1)

TBD

Voice and data frames (message class 0xf2)

#define FRAME_TYPE_TRAFFIC_CHANNEL  0
#define FRAME_TYPE_SDS_TRANSFER     1
#define FRAME_TYPE_SDS_REPORT       2
#define FRAME_TYPE_DTMF_DATA        3
#define FRAME_TYPE_PACKET_DATA      4

struct BrewFrameData
{
  uint8_t kind;       // 0xf2
  uint8_t type;       // FRAME_TYPE_*
  uuid_t identifier;  // Call session UUID
  uint16_t length;    // Length of following data in bits
  uint8_t data[0];
} __attribute__((packed));
FRAME_TYPE_TRAFFIC_CHANNEL

TBD

FRAME_TYPE_SDS_TRANSFER

Data contains full SDS Type 4 PDU. So the first octet of data should contain protocol identifier, defined at ETSI TS 100 392-2 V3.9.1 (2019-01), Table 29.21

FRAME_TYPE_SDS_REPORT

This frame indicates SDS delivery and NOT SDS-TL delivery report. Data contains single-byte status code:

  • 0 = Success
FRAME_TYPE_DTMF_DATA

Data contains single DTMF code encoded in ASCII: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '#', 'A', 'B', 'C', 'D' 

FRAME_TYPE_PACKET_DATA

Data field contains an IPv4 or IPv6 packet