AlexxIT/go2rtc · error
multitrans: talkback error
Error message
multitrans: talkback error: %s
What it means
openTalkChannel checks the Multitrans talkback HTTP response body for the literal "error_code":0 (mirroring the reference Python client). If the body lacks it, the whole response body is included in the error. The endpoint responded 200 OK but reported an application-level talkback failure.
Solutions
- Log/inspect string(res.Body) in the error to read the actual error_code and message.
- Confirm the device supports talkback and no other session is using the audio channel.
- Check the credentials/token used when constructing the talkback request URL.
- Retry after closing other talkback sessions; some devices allow a single talkback client.
- If the server uses spaced JSON, parse the body as JSON instead of the substring check (library-side fix).
Example fix
// before (client side retry loop slams an occupied channel)
for {
_ = client.StartTalkback(media)
}
// after
if err := client.StartTalkback(media); err != nil {
log.Printf("talkback busy/failed: %v", err)
time.Sleep(5 * time.Second)
} Defensive patterns
Strategy: try-catch
Validate before calling
// check the device exposes a talkback endpoint before opening the channel
if !device.Capabilities.Talkback { return errors.New("talkback unsupported") } Try / catch
if err := openTalkback(media); err != nil {
if strings.Contains(err.Error(), "talkback error") {
log.Printf("talkback body: %v", err) // includes raw response body
time.Sleep(backoff)
retry()
}
} Prevention
- Serialize talkback sessions — one client at a time per camera
- Verify device model supports two-way audio before wiring talkback
- Read the embedded response body to distinguish busy vs auth errors
- Add bounded retries with backoff for transient busy states
When it happens
Trigger: Opening a talkback (two-way audio) channel where the server returns a body with a non-zero error_code, a JSON shape like "error_code": 0 (with space, which the naive bytes.Contains misses), or an HTML error page instead of JSON.
Common situations: Camera rejects talkback because another client holds the audio channel; wrong credentials embedded in the talkback URL; device firmware returns pretty-printed JSON the string check misreads; talkback unsupported on the device model.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/3469d18e5ac8165a.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/multitrans/client.go:185
data := fmt.Sprintf("MULTITRANS %s RTSP/1.0\r\nCSeq: 2\r\nSession: %s\r\nContent-Type: application/json\r\nContent-Length: %d\r\n\r\n%s",
uri, session, len(payload), payload)
if _, err := c.conn.Write([]byte(data)); err != nil {
return err
}
res, err := tcp.ReadResponse(c.rd)
if err != nil {
return err
}
if res.StatusCode != http.StatusOK {
return errors.New("multitrans: talkback failed: " + res.Status)
}
// Python checks for "error_code":0 in body.
if !bytes.Contains(res.Body, []byte(`"error_code":0`)) {
return fmt.Errorf("multitrans: talkback error: %s", string(res.Body))
}
return nil
}
func (c *Client) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error) {
return nil, core.ErrCantGetTrack
}
func (c *Client) Start() error {
_ = c.closed.Wait()
return nil
}
func (c *Client) Stop() error {
c.closed.Done(nil)
return c.Connection.Stop()
}View on GitHub (pinned to c245815e75)