You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DialIn.ts 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import type { Participant } from '../../helpers/Participant';
  2. /**
  3. * Helper functions for dial-in related operations.
  4. * To be able to create a fake dial-in test that will run most of the logic for the real dial-in test.
  5. */
  6. /**
  7. * Waits for the audio from the dial-in participant.
  8. * @param participant
  9. */
  10. export async function waitForAudioFromDialInParticipant(participant: Participant) {
  11. // waits 15 seconds for the participant to join
  12. await participant.waitForParticipants(1, `dial-in.test.jigasi.participant.no.join.for:${
  13. ctx.times.restAPIExecutionTS + 15_000} ms.`);
  14. const joinedTS = performance.now();
  15. console.log(`dial-in.test.jigasi.participant.join.after:${joinedTS - ctx.times.restAPIExecutionTS}`);
  16. await participant.waitForIceConnected();
  17. await participant.waitForRemoteStreams(1);
  18. await participant.waitForSendReceiveData(20_000, 'dial-in.test.jigasi.participant.no.audio.after.join');
  19. console.log(`dial-in.test.jigasi.participant.received.audio.after.join:${performance.now() - joinedTS} ms.`);
  20. }
  21. /**
  22. * Cleans up the dial-in participant by kicking it if the local participant is a moderator.
  23. * @param participant
  24. */
  25. export async function cleanup(participant: Participant) {
  26. // cleanup
  27. if (await participant.isModerator()) {
  28. const jigasiEndpointId = await participant.driver.execute(() => APP.conference.listMembers()[0].getId());
  29. await participant.getFilmstrip().kickParticipant(jigasiEndpointId);
  30. }
  31. }
  32. /**
  33. * Checks if the dial-in is enabled.
  34. * @param participant
  35. */
  36. export async function isDialInEnabled(participant: Participant) {
  37. return await participant.driver.execute(() => Boolean(
  38. config.dialInConfCodeUrl && config.dialInNumbersUrl && config.hosts?.muc));
  39. }