Skip to content

Commit 9d9583c

Browse files
authored
Merge pull request #20 from wajiw/feature-playEarlyMedia
Adding new PlayEarlyMedia PERCL command to the SDK
2 parents 8bf8a4f + cb7deb0 commit 9d9583c

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

docs/source/percl/percl.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ play(file, options)
160160

161161
:returns: {{Play}} An object representing a Play command.
162162

163+
playEarlyMedia(file)
164+
--------------------
165+
166+
Build a PlayEarlyMedia PerCL command.
167+
168+
:file: {string} The URL of the audio file to be played to the caller.
169+
170+
:returns: {{PlayEarlyMedia}} An object representing a PlayEarlyMedia command.
171+
163172
say(text, options)
164173
--------------------
165174

@@ -213,4 +222,4 @@ build(scripts)
213222

214223
:scripts: ...{object} One or more PerCL commands.
215224

216-
:returns: {[script]} Returns all the provided PerCL commands wrapped in an array.
225+
:returns: {[script]} Returns all the provided PerCL commands wrapped in an array.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@persephony/sdk",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "The SDK for the Persephony API",
55
"homepage":"https://www.persephony.com",
66
"bugs":{

src/percl/percl.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,16 @@ function play (file, options) {
188188
return {Play: assign({file: file}, options)}
189189
}
190190

191+
/**
192+
* Build a PlayEarlyMedia PerCL command.
193+
*
194+
* @param {string} file - The URL of the audio file to be played to the caller.
195+
* @returns {{PlayEarlyMedia}} - An object representing a PlayEarlyMedia command.
196+
*/
197+
function playEarlyMedia (file) {
198+
return {PlayEarlyMedia: {file: file}}
199+
}
200+
191201
/**
192202
* Build a Say PerCL command.
193203
*
@@ -263,6 +273,7 @@ module.exports = {
263273
recordUtterance: recordUtterance,
264274
startRecordCall: startRecordCall,
265275
play: play,
276+
playEarlyMedia: playEarlyMedia,
266277
say: say,
267278
getDigits: getDigits,
268279
getSpeech: getSpeech,

src/percl/percl.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ describe('percl', function () {
164164
expect(percl.play(file, {loop: loop, conferenceId: conferenceId})).toEqual({Play: {file: file, loop: loop, conferenceId: conferenceId}})
165165
})
166166
})
167+
describe('playEarlyMedia', function () {
168+
var file = 'http://file.url'
169+
it('should create a playEarlyMedia command', function () {
170+
expect(percl.playEarlyMedia(file)).toEqual({PlayEarlyMedia: {file: file}})
171+
})
172+
})
167173
describe('say', function () {
168174
it('should return a Say command with the text set to the parameter value', function () {
169175
var expectedText = 'Hello World'

0 commit comments

Comments
 (0)