Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/livekit-server-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ try {
});
} catch (e) {
if (e instanceof SipCallError) {
console.log(e.message); // e.g. "SIP call failed: 486 Busy Here (resource_exhausted)"
console.log(e.message); // e.g. "SIP call failed: 486 Busy Here (failed_precondition)"
if (e.sipStatusCode === 486) {
// callee is busy
}
Expand Down
4 changes: 2 additions & 2 deletions packages/livekit-server-sdk/src/TwirpRPC.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('SipCallError', () => {
'Too Many Requests',
'twirp error: sip status 486',
429,
'resource_exhausted',
'failed_precondition',
{
sip_status_code: '486',
sip_status: 'Busy Here',
Expand All @@ -30,7 +30,7 @@ describe('SipCallError', () => {
expect(printed).toContain('SipCallError');
expect(printed).toContain('486');
expect(printed).toContain('Busy Here');
expect(printed).toContain('resource_exhausted');
expect(printed).toContain('failed_precondition');
expect(printed).toContain('region=us-east'); // other metadata is surfaced
expect(printed).not.toContain('error_details'); // opaque blob is omitted
});
Expand Down
4 changes: 2 additions & 2 deletions packages/livekit-server-sdk/test/api/livekitapi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,15 @@ d('LiveKitAPI', () => {
// A failed dial surfaces the SIP response status as a SipCallError, whose
// getters expose the SIP code/reason while the generic Twirp code is preserved.
describe('sip call errors', () => {
it('surfaces a busy signal (resource_exhausted)', async () => {
it('surfaces a busy signal (failed_precondition)', async () => {
const err = await withMock({ sipStatus: { code: 486, status: 'Busy Here' } }, () =>
api.sip.createSipParticipant('ST_abc123', '+15105550100', 'test-room'),
).catch((e: unknown) => e);

expect(err).toBeInstanceOf(SipCallError);
expect(err).toBeInstanceOf(ServerError);
const sipErr = err as SipCallError;
expect(sipErr.code).toBe('resource_exhausted');
expect(sipErr.code).toBe('failed_precondition');
expect(sipErr.sipStatusCode).toBe(486);
expect(sipErr.sipStatus).toBe('Busy Here');
// printable representation makes the failure clear
Expand Down
Loading