Exception: LiveKit::SipCallError

Inherits:
ServerError
  • Object
show all
Defined in:
lib/livekit/errors.rb

Overview

Raised when a SIP dialing call (create_sip_participant / transfer_sip_participant) fails with a SIP response status. The SIP code and reason are exposed directly; any other metadata remains available via LiveKit::ServerError#metadata.

Instance Attribute Summary

Attributes inherited from ServerError

#code, #metadata

Instance Method Summary collapse

Methods inherited from ServerError

from, #initialize

Constructor Details

This class inherits a constructor from LiveKit::ServerError

Instance Method Details

#messageObject Also known as: to_s

A clear, SIP-specific representation, including any extra metadata.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/livekit/errors.rb', line 46

def message
  code_str = ["sip_status_code"]
  return super if code_str.nil?

  reason = ["sip_status"]
  result = "SIP call failed: #{code_str}"
  result += " #{reason}" if reason && !reason.empty?
  result += " (#{code})"
  extra = .reject { |k, _| %w[sip_status_code sip_status error_details].include?(k) }
  result += " [#{extra.map { |k, v| "#{k}=#{v}" }.join(", ")}]" unless extra.empty?
  result
end

#sip_statusString?

Returns the SIP reason phrase, e.g. "Busy Here".

Returns:

  • (String, nil)

    the SIP reason phrase, e.g. "Busy Here"



41
42
43
# File 'lib/livekit/errors.rb', line 41

def sip_status
  ["sip_status"]
end

#sip_status_codeInteger?

Returns the SIP response code, e.g. 486 (Busy Here).

Returns:

  • (Integer, nil)

    the SIP response code, e.g. 486 (Busy Here)



35
36
37
38
# File 'lib/livekit/errors.rb', line 35

def sip_status_code
  raw = ["sip_status_code"]
  raw && raw.to_i
end