Commit a23fb51a authored by sergey's avatar sergey

add recordFile and Answer

parent 2934afa1
......@@ -101,10 +101,25 @@ Context.prototype.dial = function (num, timeout, params, cb) {
this.exec('Dial', num + ',' + timeout + ',' + params, cb);
};
Context.prototype.getVariable = function(name, cb) {
Context.prototype.getVariable = function (name, cb) {
this.send('GET VARIABLE ' + name + '\n', cb || function() { });
};
Context.prototype.answer = function (cb) {
this.send('ANSWER' + '\n', cb || function() { });
};
Context.prototype.recordFile = function (filename, format, escape_digits, timeout, cb) {
var str = [
'"'+filename+'"',
format,
escape_digits,
parseInt(timeout)*1000,
'0 1 2'
].join(' ');
this.send('RECORD FILE ' + str + '\n', cb || function() { });
};
Context.prototype.sayNumber = function(number, escape_digits, cb) {
this.send('SAY NUMBER ' + number + ' "' + escape_digits + '"' + '\n', cb || function() { });
};
......
......@@ -2,7 +2,7 @@
"author": "Sergey Dmitriev <serge.dmitriev@gmail.com>",
"name": "ding-dong",
"description": "AGI (Asterisk Gateway Interface) for writing dialplan scripts",
"version": "0.0.2",
"version": "0.0.3",
"repository": {
"type": "git",
"url": "git://github.com/antirek/ding-dong.git"
......
......@@ -177,6 +177,19 @@ describe('Context', function() {
});
});
describe('record file', function() {
it('record', function() {
this.context.recordFile('test', 'wav', '#', function() {});
expect(this.context.sent.join('')).to.eql('STREAM FILE "test" # "\n');
});
it('defaults to all digits', function() {
this.context.streamFile('test', function() {});
expect(this.context.sent.join('')).to.eql('STREAM FILE "test" "1234567890#*"\n');
});
});
describe('waitForDigit', function() {
it('sends with default timeout', function() {
this.context.waitForDigit(function() {});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment