diff --git a/package.json b/package.json index 05d5e81..d90c489 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@profullstack/groupcall", - "version": "0.15.1", + "version": "0.15.2", "description": "group.call: a party line for people and AI agents. Make a room, get a four-digit code, everyone dials one number and keys it. Agents phone in too, with names and real voices. Web, PWA, desktop, API, CLI, TUI and MCP; sign in with CoinPay.", "license": "MIT", "type": "module", diff --git a/src/service.ts b/src/service.ts index 108507d..3f03206 100644 --- a/src/service.ts +++ b/src/service.ts @@ -233,6 +233,12 @@ export class GroupCallService { }, onInvite: (code, who, digits) => this.callInFromLine(code, who, digits), onJoin: (code, who, info) => { + // A phone the room rang has no caller number on its leg: it is the number we dialled, so a + // known caller rung in (Anthony) is named and trusted like one who dialled in. + if (!who.from) { + const dialled = store.dialled(who.leg) + if (dialled?.to.startsWith('+')) who.from = dialled.to + } if (info.conferenceId) store.saveLeg(code, info.conferenceId, info.startedAt, who) if (info.conferenceId && store.room(code)?.record) void this.startRecording(code, info.conferenceId) this.record(code, 'join', who, info.callers) diff --git a/src/version.ts b/src/version.ts index 294ba1d..50201c3 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.15.1' +export const VERSION = '0.15.2' diff --git a/test/app.test.ts b/test/app.test.ts index 524533c..27bcf74 100644 --- a/test/app.test.ts +++ b/test/app.test.ts @@ -472,6 +472,15 @@ describe('calling someone in', () => { expect(svc.live(room.code)).toEqual([expect.objectContaining({ name: 'Anthony', kind: 'person' })]) }) + test('a known caller the room rang in is named and trusted, though the leg carries no caller number', async () => { + const { call, event, svc } = setup({ knownCallers: { '+14086562473': 'Anthony' } }) + const room = (await (await call('gc_op', 'POST', '/api/v1/rooms', { name: 'Standup' })).json()) as any + await call('gc_op', 'POST', `/api/v1/rooms/${room.code}/call`, { phone: '408-656-2473' }) + await event('call.answered', { call_control_id: 'out-1', direction: 'outgoing' }) + await event('call.gather.ended', { call_control_id: 'out-1', digits: '1' }) + expect(svc.live(room.code)).toEqual([expect.objectContaining({ name: 'Anthony', kind: 'person', trusted: true })]) + }) + test('a free account cannot ring phones, and nobody can ring premium lines or our own', async () => { const { call, telnyx } = setup() const mine = (await (await call('gc_guest', 'POST', '/api/v1/rooms', { name: 'mine' })).json()) as any