UNPKG

ivr-tester

Version:

An automated testing framework for IVR call flows

20 lines (19 loc) 871 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.callConnectedTimeout = void 0; const callConnectedTimeout = ({ msTimeoutWaitingForCall, }) => ({ initialise(pluginHost) { pluginHost.on("callServerStarted", ({ callServer }) => { let timeoutCallbackId; pluginHost.on("callRequested", () => { clearTimeout(timeoutCallbackId); timeoutCallbackId = setTimeout(() => { pluginHost.abortTests(`call did not connect after ${msTimeoutWaitingForCall / 1000}s`); }, msTimeoutWaitingForCall); }); callServer.on("stopped", () => clearTimeout(timeoutCallbackId)); callServer.on("callConnected", () => clearTimeout(timeoutCallbackId)); }); }, }); exports.callConnectedTimeout = callConnectedTimeout;