feat: play verb url support single or array list url (#158)

* feat: update time-series 0.11.12

* feat: support play verb url in plain text or array

* fix: review comment

Co-authored-by: Dave Horton <daveh@beachdognet.com>
This commit is contained in:
xquanluu
2022-08-25 15:09:48 +07:00
committed by GitHub
parent 4f0439dad9
commit 127432f2ec
14 changed files with 323 additions and 20 deletions

View File

@@ -541,6 +541,9 @@ class Conference extends Task {
}
this.logger.debug(`Conference:_playHook: executing ${tasks.length} tasks`);
/* we might have been killed while off fetching waitHook */
if (this.killed) return [];
if (tasks.length > 0) {
this._playSession = new ConfirmCallSession({
logger: this.logger,

View File

@@ -24,7 +24,13 @@ class TaskPlay extends Task {
while (!this.killed && (this.loop === 'forever' || this.loop--) && this.ep.connected) {
if (cs.isInConference) {
const {memberId, confName, confUuid} = cs;
await this.playToConfMember(this.ep, memberId, confName, confUuid, this.url);
if (Array.isArray(this.url)) {
for (const playUrl of this.url) {
await this.playToConfMember(this.ep, memberId, confName, confUuid, playUrl);
}
} else {
await this.playToConfMember(this.ep, memberId, confName, confUuid, this.url);
}
}
else await ep.play(this.url);
}

View File

@@ -84,7 +84,7 @@
},
"leave": {
"properties": {
}
},
"hangup": {
@@ -96,7 +96,7 @@
},
"play": {
"properties": {
"url": "string",
"url": "string|array",
"loop": "number|string",
"earlyMedia": "boolean"
},
@@ -514,7 +514,7 @@
"properties": {
"enable": "boolean",
"voiceMs": "number",
"mode": "number"
"mode": "number"
},
"required": [
"enable"
@@ -536,7 +536,7 @@
"noSpeechTimeoutMs": "number",
"decisionTimeoutMs": "number",
"toneTimeoutMs": "number",
"greetingCompletionTimeoutMs": "number"
"greetingCompletionTimeoutMs": "number"
}
}
}