diff --git a/lib/endpoint.js b/lib/endpoint.js index 5452697..866dc68 100644 --- a/lib/endpoint.js +++ b/lib/endpoint.js @@ -902,7 +902,10 @@ class Endpoint extends EventEmitter { if (flags.moderator) data.moderator = true; if (flags.endconf) data.endConf = true; if (flags.mute) data.startMuted = true; - // flags['dist-dtmf'] (distribute DTMF to the room) is Phase 2. + // flags['dist-dtmf']: this member's DTMF is regenerated as RFC 2833 on + // every other member's leg (mod_conference dist-dtmf semantics — the flag + // is on the sender, recipients need nothing). + if (flags['dist-dtmf']) data.distDtmf = true; const res = await this._request('room.join', data); this._roomName = conf; this._roomMemberId = res.memberId; diff --git a/test/conference.test.js b/test/conference.test.js index c60d4dc..bbb3ce5 100644 --- a/test/conference.test.js +++ b/test/conference.test.js @@ -34,6 +34,24 @@ test('join sends room.join with mapped flags and returns fsmrf shape', async () assert.deepStrictEqual(res, { memberId: '7', confUuid: 'u-1' }); }); +test("join maps flags['dist-dtmf'] to distDtmf", async () => { + const { ep, calls } = makeEp((cmd) => + cmd === 'room.join' ? { roomUuid: 'u-2', memberId: 3 } : {}); + await ep.join('myconf', { flags: { 'dist-dtmf': true } }); + + const join = calls.find((c) => c.cmd === 'room.join'); + assert.deepStrictEqual(join.data, { room: 'myconf', distDtmf: true }); +}); + +test('join omits distDtmf when dist-dtmf is not set', async () => { + const { ep, calls } = makeEp((cmd) => + cmd === 'room.join' ? { roomUuid: 'u-3', memberId: 4 } : {}); + await ep.join('myconf', { flags: { moderator: true } }); + + const join = calls.find((c) => c.cmd === 'room.join'); + assert.ok(!('distDtmf' in join.data), 'distDtmf must be absent when the flag is off'); +}); + test('api conference get count returns the count as a body string', async () => { const { ep } = makeEp((cmd) => (cmd === 'room.query' ? { found: true, count: 3 } : {})); const res = await ep.api('conference', ['myconf', 'get', 'count']);