Commit d28556a7 authored by antirek's avatar antirek

change createServer

parent 0ec9af17
var ding = require('./lib/index');
var AGIServer = require('./lib/index');
var handler = function (context) {
context.onEvent('variables')
.then(function (vars) {
return context.streamFile('beep');
});
.then(function (vars) {
return context.streamFile('beep');
});
};
ding.createServer(handler).listen(3000);
var agi = new AGIServer(handler);
agi.start(3000);
//ding.createServer(handler).listen(3000);
var Context = require('./context');
var agi = {
state: require('./state'),
Context: Context,
createServer: function (handler) {
return require('net').createServer(function (stream) {
var context = new Context(stream);
handler(context);
});
}
var agi = function (handler) {
var server;
var handle = function (stream) {
var context = new Context(stream);
handler(context);
};
var start = function (port) {
server = require('net').createServer(handle).listen(port);
};
return {
start: start
};
};
module.exports = agi;
module.exports = agi;
\ No newline at end of file
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