UNPKG

@ama-team/voxengine-definitions

Version:
290 lines (256 loc) 6.98 kB
/** * @class Call */ /** * Please not that this is virtual definition, and {@link Call} doesn't have such member * * @callback Call.eventHandler * @param {Object} event */ /** * Add handler for specific event generated by call in specific application state * * @function Call#addEventListener * * @param {function} callevent Event class specified in {@link CallEvents} * @param {Call.eventHandler} handler Handler function. A single parameter is passed - object with event information */ /** * Answer incoming call * * @function Call#answer * * @param {object<string, string>} [extraHeaders] Optional custom parameters (SIP headers) that should be passed with * answer message. Parameter names must start with "X-" to be processed by application */ /** * Returns Caller ID for call * * @function Call#callerid * * @return {string} */ /** * Set or get custom string associated with call. It can be later obtained from Call History using HTTP API. * * @function Call#customData * * @param {string|undefined} cData Custom call data to set * * @return {string} */ /** * Reject incoming call * * @function Call#decline * * @param {Number} [code] SIP status code * @param {object<string, string>} [extraHeaders] Optional custom parameters (SIP headers) that should be passed with * answer message. Parameter names must start with "X-" to be processed by application */ /** * Detect progress tone on outgoing call * * @function Call#detectProgressTone */ /** * Detect voicemail prompt on the call. Please note that this method is based on specific audio signal pattern which * isn't always in place, so there is no 100% guarantee that it will detect voicemail in all situations. * * @function Call#detectVoicemailPrompt * * @param {Number} [timeout] Optional before speech timeout in sec. 5 sec by default * @param {Number} [speechDuration] Optional speech duration in sec. 2 sec by default */ /** * Detect tone signal in the range 500 - 2000 Hz on the call * * @function Call#detectVoicemailTone * * @param {Number} [timeout] Optional timeout in sec. 20 sec by default * @param {Number} [threshold] Minimal detected tone duration. 100 ms by default */ /** * Returns Display name for the call * * @function Call#displayName * * @return {string} */ /** * Handle microphone status on the call * * @function Call#handleMicStatus * * @param {boolean} handle */ /** * Change DTMF processing mode * * @function Call#handleTones * * @param {boolean} doHandle */ /** * End the call * * @function Call#hangup * * @param {object<string, string>} extraHeaders */ /** * Returns call id * * @function Call#id * * @return {string} */ /** * Returns true if the call is incoming, false if it was originated from script * * @function Call#incoming * * @return {boolean} */ /** * Returns dialed number * * @function Call#number * * @return {string} */ /** * Play country specific progress tone * * Note that for this to work properly for call that is not yet connected, you need to invoke * {@link Call.startEarlyMedia} before using this function * * @function Call#playProgressTone * * @param {('RU'|'US')} country 2-digit country code. Currently supported values are US, RU */ /** * Start recording call. Both incoming and outgoing streams are being recorded. Emits {@link CallEvents.RecordStarted} * and {@link CallEvents.RecordStopped} events. * * @function Call#record * * @param {VoxEngine.RecorderParameters} [params] Recorder parameters */ /** * Reject incoming call * * @function Call#reject * * @param {Number} [code] SIP status code * @param {object} extraHeaders Optional custom parameters (SIP headers) that should be passed with * answer message. Parameter names must start with "X-" to be processed by application */ /** * Remove event handler for specific event generated by call in specific application state * * @function Call#removeEventListener * * @param {function} callevent Event class specified in {@link CallEvents} * @param {Call.eventCallback} handler Handler function. If not specified, all event listeners are removed */ /** * Send call progress tone to specific call * * @function Call#ring * * @param {object} [extraHeaders] Optional custom parameters (SIP headers) that should be passed with * the message. Parameter names must start with "X-" to be processed by application */ /** * Say some text to the call * * @function Call#say * * @param {string} text Message that will be played to the call * @param {Language} [language] Language and voice to be used * @param {VoxEngine.TTSOptions} [ttsoptions] Optional parameters for TTS */ /** * Send DTMF digits to the peer * * @function Call#sendDigits * * @param {string} digits Any combination of 0-9, *, #, p (pause) symbols */ /** * Send Info (SIP INFO) message inside the call * * @function Call#sendInfo * * @param {String} mimeType MIME type of the message * @param {String} body Message content * @param {object} [headers] Optional headers to be passed with the message */ /** * Start sending media (voice and video) from this call to media unit specified in targetMediaUnit. Each call can send * media to any number of other calls, but can receive from just one. So if targetCall was already receiving media from * another call, that link would break. * * @function Call#sendMediaTo * * @param {Call|Conference} targetMediaUnit media unit that will receive media */ /** * Send text message during the call * * @function Call#sendMessage * * @param {string} text Message text */ /** * Start playing early media to the call. Can be used to play voicemail prompt * * @function Call#startEarlyMedia * * @param {object} [extraHeaders] Optional custom parameters (SIP headers) that should be passed with the message. * Parameter names must start with "X-" to be processed by application */ /** * Play audio file to the call * * @function Call#startPlayback * * @param {string} url HTTP/HTTPS url of audio file. Supported formats are: mp3, ogg. Maximum file size if 2 MBytes * @param {boolean} [loop] If true, playback will be looped. */ /** * Returns current state of the call * * @todo document possible return values * * @function Call#state * * @return {('TERMINATED'|'PROGRESSING'|string)} */ /** * Stop sending media (voice and video) from this call to media unit specified in targetMediaUnit. * * @function Call#stopMediaTo * * @param {Call|Conference} targetMediaUnit media unit that will not receive media from this call anymore. */ /** * Stop audio playback that was started before by calling startPlayback * * @function Call#stopPlayback */ /** * Returns human-readable description of the call * * @function Call#toString * * @return {string} */ /** * Returns VAD status * * @function Call#vad * * @return {boolean} */