Commit 8ec64e4c authored by sergey's avatar sergey

add all functions

parent d37f0f76
...@@ -103,6 +103,54 @@ Context.prototype.dial = function (num, timeout, params, cb) { ...@@ -103,6 +103,54 @@ Context.prototype.dial = function (num, timeout, params, cb) {
this.exec('Dial', num + ',' + timeout + ',' + params, cb); this.exec('Dial', num + ',' + timeout + ',' + params, cb);
}; };
Context.prototype.databaseDel = function (family, key, cb) {
this.send('DATABASE DEL ' + family + ' ' + key + '\n', cb || function () { });
};
Context.prototype.databaseDelTree = function (family, keytree, cb) {
this.send('DATABASE DELTREE ' + family + ' ' + keytree + '\n', cb || function () { });
};
Context.prototype.databaseGet = function (family, key, cb) {
this.send('DATABASE GET ' + family + ' ' + key + '\n', cb || function () { });
};
Context.prototype.databasePut = function (family, key, value, cb) {
this.send('DATABASE PUT ' + family + ' ' + key + ' ' + value + '\n', cb || function () { });
};
Context.prototype.speechCreate = function (engine, cb) {
this.send('SPEECH CREATE ' + engine + '\n', cb || function () { });
};
Context.prototype.speechDestroy = function (cb) {
this.send('SPEECH DESTROY\n', cb || function () { });
};
Context.prototype.speechActivateGrammar = function (name, cb) {
this.send('SPEECH ACTIVATE GRAMMAR ' + name + '\n', cb || function () { });
};
Context.prototype.speechDeactivateGrammar = function (name, cb) {
this.send('SPEECH DEACTIVATE GRAMMAR ' + name + '\n', cb || function () { });
};
Context.prototype.speechLoadGrammar = function (name, path, cb) {
this.send('SPEECH LOAD GRAMMAR ' + name + ' ' + path + '\n', cb || function () { });
};
Context.prototype.speechUnloadGrammar = function (name, cb) {
this.send('SPEECH UNLOAD GRAMMAR ' + name + '\n', cb || function () { });
};
Context.prototype.speechSet = function (name, value, cb) {
this.send('SPEECH SET ' + name + ' ' + value + '\n', cb || function () { });
};
Context.prototype.speechRecognize = function (prompt, timeout, offset, cb) {
this.send('SPEECH RECOGNIZE ' + prompt + ' ' + timeout + ' ' + offset + '\n', cb || function () { });
};
Context.prototype.getVariable = function (name, cb) { Context.prototype.getVariable = function (name, cb) {
this.send('GET VARIABLE ' + name + '\n', cb || function () { }); this.send('GET VARIABLE ' + name + '\n', cb || function () { });
}; };
......
{ {
"author": "Sergey Dmitriev <serge.dmitriev@gmail.com>", "author": "Sergey Dmitriev <serge.dmitriev@gmail.com>",
"name": "ding-dong", "name": "ding-dong",
"description": "AGI (Asterisk Gateway Interface) for writing dialplan scripts", "description": "Write AGI-server quickly! (AGI - Asterisk Gateway Interface)",
"version": "0.0.7", "version": "0.0.8",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/antirek/ding-dong.git" "url": "git://github.com/antirek/ding-dong.git"
......
...@@ -146,6 +146,90 @@ describe('Context', function() { ...@@ -146,6 +146,90 @@ describe('Context', function() {
}); });
}); });
describe('databaseDel', function() {
it('sends correct command', function() {
this.context.databaseDel('family', 'test');
expect(this.context.sent.join('')).to.eql('DATABASE DEL family test\n');
});
});
describe('databaseDelTree', function() {
it('sends correct command', function() {
this.context.databaseDelTree('family', 'test');
expect(this.context.sent.join('')).to.eql('DATABASE DELTREE family test\n');
});
});
describe('databaseGet', function() {
it('sends correct command', function() {
this.context.databaseGet('family', 'test');
expect(this.context.sent.join('')).to.eql('DATABASE GET family test\n');
});
});
describe('databasePut', function() {
it('sends correct command', function() {
this.context.databasePut('family', 'test', 'value');
expect(this.context.sent.join('')).to.eql('DATABASE PUT family test value\n');
});
});
describe('speechCreate', function() {
it('sends correct command', function() {
this.context.speechCreate('engine');
expect(this.context.sent.join('')).to.eql('SPEECH CREATE engine\n');
});
});
describe('speechDestroy', function() {
it('sends correct command', function() {
this.context.speechDestroy();
expect(this.context.sent.join('')).to.eql('SPEECH DESTROY\n');
});
});
describe('speechActivateGrammar', function() {
it('sends correct command', function() {
this.context.speechActivateGrammar('name');
expect(this.context.sent.join('')).to.eql('SPEECH ACTIVATE GRAMMAR name\n');
});
});
describe('speechDeactivateGrammar', function() {
it('sends correct command', function() {
this.context.speechDeactivateGrammar('name');
expect(this.context.sent.join('')).to.eql('SPEECH DEACTIVATE GRAMMAR name\n');
});
});
describe('speechLoadGrammar', function() {
it('sends correct command', function() {
this.context.speechLoadGrammar('name', 'path');
expect(this.context.sent.join('')).to.eql('SPEECH LOAD GRAMMAR name path\n');
});
});
describe('speechUnloadGrammar', function() {
it('sends correct command', function() {
this.context.speechUnloadGrammar('name');
expect(this.context.sent.join('')).to.eql('SPEECH UNLOAD GRAMMAR name\n');
});
});
describe('speechSet', function() {
it('sends correct command', function() {
this.context.speechSet('name', 'value');
expect(this.context.sent.join('')).to.eql('SPEECH SET name value\n');
});
});
describe('speechRecognize', function() {
it('sends correct command', function() {
this.context.speechRecognize('prompt', 'timeout', 'offset');
expect(this.context.sent.join('')).to.eql('SPEECH RECOGNIZE prompt timeout offset\n');
});
});
describe('setVariable', function() { describe('setVariable', function() {
it('sends correct command', function() { it('sends correct command', function() {
this.context.setVariable('test', 'test'); this.context.setVariable('test', 'test');
......
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