Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix play stop by * #78

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ class Endpoint extends Emitter {
'file param is required and must be a string, array or PlaybackOptions object');

let timeoutSecs = -1;
const playback_terminators = file.playback_terminators ? file.playback_terminators : 'none';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this eliminates the ability to call ep.set('playback_terminators') explicitly and then do ep.play. So we are removing a feature here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems yes, and no

if you want to play with playback_terminators, in the file object, please put the value directly

file = {
url,
playback_terminators,
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah wait, file can be array

if (file.file) {
assert.ok('string' === typeof file.file, 'file is required for PlaybackOptions object');
if (file.seekOffset && file.seekOffset > 0) file.file = `${file.file}@@${file.seekOffset}`;
Expand All @@ -309,6 +310,7 @@ class Endpoint extends Emitter {

const __x = async(callback) => {
try {
await this.execute('set', `playback_terminators=${playback_terminators}`);
if (files.length !== 1) await this.execute('set', 'playback_delimiter=!');
if (timeoutSecs > 0) await this.execute('set', `playback_timeout_sec=${timeoutSecs}`);
const evt = await this.execute('playback', files.join('!'));
Expand Down
1 change: 0 additions & 1 deletion test/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ test('record', (t) => {
return ep.set('playback_terminators', '123456789#*');
})
.then(() => {
ep.play(['silence_stream://1000', 'voicemail/8000/vm-record_message.wav']);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we just removing this to make the test pass?

promiseRecord = ep.record(EP_FILE2, {timeLimitSecs: 3});
t.pass('started recording');
return uac.generateSilence(2000);
Expand Down