Feature/siprec server (#143)

* fixes from testing

* modify Task#exec to take resources as an object rather than argument list

* pass 2 endpoints to Transcribe when invoked in a SipRec call session

* logging

* change siprec invite to sendrecv just so freeswitch does not try to reinvite (TODO: block outgoing media at rtpengine)

* Config: when enabling recording, block until siprec dialog is established

* missed play verb in commit 031c79d

* linting

* bugfix: get final transcript in siprec call
This commit is contained in:
Dave Horton
2022-08-09 15:23:55 +02:00
committed by GitHub
parent f068aa5390
commit 3298918322
24 changed files with 87 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
const { v4: uuidv4 } = require('uuid');
const {CallDirection, TaskName} = require('./utils/constants');
const {CallDirection, AllowedSipRecVerbs} = require('./utils/constants');
const {parseSiprecPayload} = require('./utils/siprec-utils');
const CallInfo = require('./session/call-info');
const HttpRequestor = require('./utils/http-requestor');
@@ -296,10 +296,9 @@ module.exports = function(srf, logger) {
if (0 === app.tasks.length) throw new Error('no application provided');
if (siprec) {
/* only transcribe and/or listen allowed on an incoming siprec call */
const tasks = app.tasks.filter((t) => [TaskName.Config, TaskName.Listen, TaskName.Transcribe].includes(t.name));
const tasks = app.tasks.filter((t) => AllowedSipRecVerbs.includes(t.name));
if (0 === tasks.length) {
logger.info({tasks: app.tasks}, 'only config, transcribe and/or listen allowed on an incoming siprec call');
logger.info({tasks: app.tasks}, 'no valid verbs in app found for an incoming siprec call');
throw new Error('invalid verbs for incoming siprec call');
}
if (tasks.length < app.tasks.length) {