| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
AudioSocket is a simple TCP-based protocol for sending and receiving realtime audio streams.
There exists a protocol definition (below), a Go library, and Asterisk application and channel interfaces.
NOTE: @florentchauveau has contributed DTMF support to the AudioSocket protocol. The patch has been merged into master and will be included in Asterisk versions 20.X, 21.X, and 22.X. NOTE: @SvenKube has contributed support for higher sample rates to the AudioSocket protocol. The patch has been merged into master and will be included in Asterisk versions 20.X, 21.X, 22.X, and 23.X.
The singular design goal of AudioSocket is to present the simplest possible audio streaming protocol, initially based on the constraints of Asterisk audio. Each packet contains a three-byte header and a variable payload. The header is composed of a one-byte type and a two-byte length indicator.
The minimum message length is three bytes: type and payload-length. Hangup indication, for instance, is 0x00 0x00 0x00.
The payload length is a 16-bit unsigned integer (big endian) indicating how many bytes are in the payload.
The content of the payload is defined by the header: type and length.
Error codes are application-specific. The error codes for Asterisk are single-byte, bit-packed error codes:
There are two Asterisk implementations: a channel interface and a dialplan application interface. Each of these lends itself to simplify a different use-case, but they work in exactly the same way.
The following examples demonstrate an AudioSocket connection to a server at server.example.com running on TCP port 9092. The UUID (which is chosen arbitrarily) of the call is 40325ec2-5efd-4bd3-805f-53576e581d13.
Dialplan application:
exten = 100,1,Verbose("Call to AudioSocket via Dialplan Application")
same = n,Answer()
same = n,AudioSocket(40325ec2-5efd-4bd3-805f-53576e581d13,server.example.com:9092)
same = n,Hangup()
Channel interface:
exten = 101,1,Verbose("Call to AudioSocket via Channel interface")
same = n,Answer()
same = n,Dial(AudioSocket/server.example.com:9092/40325ec2-5efd-4bd3-805f-53576e581d13/c(slin))
same = n,Hangup()
| Back | FazBrowse Home | New Git URL |