mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
fixes for confirm session (#663)
* fixes for confirm session * allow empty dialconfirm array
This commit is contained in:
@@ -7,7 +7,8 @@ const {
|
|||||||
TaskName,
|
TaskName,
|
||||||
KillReason,
|
KillReason,
|
||||||
RecordState,
|
RecordState,
|
||||||
AllowedSipRecVerbs
|
AllowedSipRecVerbs,
|
||||||
|
AllowedConfirmSessionVerbs
|
||||||
} = require('../utils/constants');
|
} = require('../utils/constants');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
@@ -1420,6 +1421,19 @@ Duration=${duration} `
|
|||||||
tasks = pruned;
|
tasks = pruned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (this.isConfirmCallSession) {
|
||||||
|
const pruned = tasks.filter((t) => AllowedConfirmSessionVerbs.includes(t.name));
|
||||||
|
if (0 === pruned.length) {
|
||||||
|
this.logger.info({tasks},
|
||||||
|
'CallSession:replaceApplication - filtering verbs allowed on an confirmSession call');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pruned.length < tasks.length) {
|
||||||
|
this.logger.info(
|
||||||
|
'CallSession:replaceApplication - removing verbs that are not allowed for confirmSession call');
|
||||||
|
tasks = pruned;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.tasks = tasks;
|
this.tasks = tasks;
|
||||||
this.taskIdx = 0;
|
this.taskIdx = 0;
|
||||||
this.stackIdx++;
|
this.stackIdx++;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"Transcribe": "transcribe"
|
"Transcribe": "transcribe"
|
||||||
},
|
},
|
||||||
"AllowedSipRecVerbs": ["config", "gather", "transcribe", "listen", "tag"],
|
"AllowedSipRecVerbs": ["config", "gather", "transcribe", "listen", "tag"],
|
||||||
|
"AllowedConfirmSessionVerbs": ["config", "gather", "plays", "say", "tag"],
|
||||||
"CallStatus": {
|
"CallStatus": {
|
||||||
"Trying": "trying",
|
"Trying": "trying",
|
||||||
"Ringing": "ringing",
|
"Ringing": "ringing",
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ class SingleDialer extends Emitter {
|
|||||||
const json = await this.requestor.request('dial:confirm', confirmHook, this.callInfo.toJSON());
|
const json = await this.requestor.request('dial:confirm', confirmHook, this.callInfo.toJSON());
|
||||||
if (!json || (Array.isArray(json) && json.length === 0)) {
|
if (!json || (Array.isArray(json) && json.length === 0)) {
|
||||||
this.logger.info('SingleDialer:_executeApp: no tasks returned from confirm hook');
|
this.logger.info('SingleDialer:_executeApp: no tasks returned from confirm hook');
|
||||||
|
this.emit('accept');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata));
|
const tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata));
|
||||||
|
|||||||
Reference in New Issue
Block a user