Commit 9a1cf963 authored by antirek's avatar antirek

fix setVariable

parent 9d48a279
var AGIServer = require('./lib/index'); var AGIServer = require('./lib/index');
var handler = function (context) { var handler = function (context) {
context.onEvent('variables') context.onEvent('variables')
.then(function (vars) { .then(function (vars) {
return context.streamFile('beep'); return context.streamFile('beep');
}) })
.then(function (result) { .then(function (result) {
return context.end(); return context.setVariable('RECOGNITION_RESULT', 'I\'m your father, Luc');
}); })
.then(function (result) {
return context.end();
});
}; };
var agi = new AGIServer(handler); var agi = new AGIServer(handler);
......
...@@ -225,7 +225,7 @@ Context.prototype.setMusic = function (musicclass) { ...@@ -225,7 +225,7 @@ Context.prototype.setMusic = function (musicclass) {
}; };
Context.prototype.setVariable = function (name, value) { Context.prototype.setVariable = function (name, value) {
return this.sendCommand('SET VARIABLE ' + name + ' ' + value); return this.sendCommand('SET VARIABLE ' + name + ' "' + value + '"');
}; };
Context.prototype.sendImage = function (image) { Context.prototype.sendImage = function (image) {
......
...@@ -235,8 +235,8 @@ describe('Context', function() { ...@@ -235,8 +235,8 @@ describe('Context', function() {
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 test test');
expect(this.context.sent.join('')).to.eql('SET VARIABLE test test\n'); expect(this.context.sent.join('')).to.eql('SET VARIABLE test "test test test"\n');
}); });
}); });
......
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