Speextalk
(C) Nicolas George - 2005-07-24

This specification can be modified and distribtued without restrictions
except: if you change it beyond spelling mistakes, you MUST staet VERY
CLEARLY that it is no longer the official Speextalk protocol.


Speextalk protocol

UDP
Default port 20977 (16 first bits of SHA1("speextalk"))
Absolute maximum packet size 4096
All numbers are big-endian

Packet description:

  First byte of a packet: type of the packet

  type = 0: handshake packet

    offset  size    description
    0       1       0
    1       1       action
    2       2       reserved
    4       2       length (l)
    6       l       comment (UTF-8)

    action = 1: connection sollicitation
    action = 2: connection accepted
    action = 3: connection rejected


  type = 1: voice packet

    offset  size    description
    0       1       1
    1       1       audio config
    2       2       sequence number of the first frame in packet, starts at 0
    4       2       size of first frame (s1)
    6       s1      first frame
    6+s1    2       size of second frame (s2)
    8+s1    s2      second frame
    8+s1+s2 2       ...

    audio config = 1: 8 kHz, mono, Speex narrowband
    audio config = 2: 16 kHz, mono, Speex wideband
    audio config = 3: 32 kHz, mono, Speex ultrawideband

    All voice packets in one discussion MUST have same audio config. Voice
    packets in both directions can have different audio config.

Dialog summary

  Client point of view

    Client sends handshake-sollicitation.
    Client waits, may retry.
    Client receives handshake-rejected => should exit.
    Client receives handshake-accept.
    Client sends and receives a lot of voice packets.

    If client receives a voice packet while waiting for handshake, it
    assumes it has receives a handshake-accept.

  Server point of view

    Server listens on default or user-specified port.
    Server receives handshake-sollicitation.
    Server asks user.
    User refuses => server sends handshake-rejected.
    Server sends handshake-accept.
    Server sends and receives a lot of voice packets.

    If server receives an unwanted packet (especially a voice packet in
    handshake phase), it may try to reset the connection with the relevant
    ICMP.
