Skip to content

Commit 72bdba8

Browse files
committed
Removed joinConference controlller
1 parent a6a310a commit 72bdba8

File tree

5 files changed

+15
-36
lines changed

5 files changed

+15
-36
lines changed

src/@types/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ export interface ConversationParticipant {
3232
'messagingBinding.proxyAddress': string;
3333
}
3434

35-
export interface JoinConferenceParams extends Request {
36-
params: {
37-
conferenceName: string
38-
}
39-
}
40-
4135
export interface ParticipantToDial {
4236
address: string,
4337
proxyAddress: string

src/controllers/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export * as conversationsPostEvent from './conversationsPostEvent'
22
export * as inboundCall from './inboundCall'
33
export * as session from './session'
4-
export * as joinConference from './joinConference'

src/controllers/joinConference.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/routes/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const router = Router()
1212
router.post('/conversations-post-event', twilio.webhook(webhookConfig), controllers.conversationsPostEvent.post)
1313

1414
router.post('/inbound-call', twilio.webhook(webhookConfig), controllers.inboundCall.post)
15-
router.post('/join-conference', twilio.webhook(webhookConfig), controllers.joinConference.get)
1615

1716
router.post('/sessions', basicAuth({
1817
users: { [AUTH_USERNAME]: AUTH_PASSWORD }

src/services/inboundCall.service.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import {
88
generateConferenceName
99
} from '../utils/'
1010

11+
export function joinConferenceTwiml (conferenceName: string) : VoiceResponse {
12+
const response = new VoiceResponse()
13+
const dial = response.dial();
14+
dial.conference(`${decodeURIComponent(conferenceName)}`);
15+
16+
return response
17+
}
18+
1119
export const generateTwiml = async (from: string, to: string) => {
1220
const response = new VoiceResponse()
1321

@@ -34,12 +42,13 @@ export const generateTwiml = async (from: string, to: string) => {
3442
const callPromises = dialList.map(pa => {
3543
console.log(`Dialing ${pa.address} from ${pa.proxyAddress}...`)
3644

37-
return client.calls.create({
38-
url: `https://${process.env.DOMAIN}/join-conference?conferenceName=${encodeURIComponent(conferenceName)}`,
39-
to: pa.address,
40-
from: pa.proxyAddress
41-
})
42-
})
45+
return client.calls.create({
46+
url: `https://${process.env.DOMAIN}/join-conference?conferenceName=${encodeURIComponent(conferenceName)}`,
47+
to: pa.address,
48+
from: pa.proxyAddress,
49+
twiml: joinConferenceTwiml(conferenceName).toString(),
50+
});
51+
});
4352

4453
await Promise.all(callPromises)
4554

0 commit comments

Comments
 (0)