tcncloud / agi-node

Asterisk FastAGI and AsyncAGI server for Node.js
MIT License
42 stars 25 forks source link

Cannot read property 'write' of null #8

Closed mariolenis closed 6 years ago

mariolenis commented 6 years ago

Hi.

I'm getting this error when I try to use the getVariable() function on channel.

TypeError: Cannot read property 'write' of null at AGIChannel.<anonymous> (/Users/mario.lenis/Dev/4sales-agi/node_modules/agi-node/lib/agi-server.js:51:18) at emitTwo (events.js:125:13) at AGIChannel.emit (events.js:213:7) at AGIChannel._sendRequest (/Users/mario.lenis/Dev/4sales-agi/node_modules/agi-node/lib/agi-channel.js:96:8) at Function.future (/Users/mario.lenis/Dev/4sales-agi/node_modules/syncho/lib/syncho.js:25:8) at Function.sync (/Users/mario.lenis/Dev/4sales-agi/node_modules/syncho/lib/syncho.js:14:24) at AGIChannel.sendRequest (/Users/mario.lenis/Dev/4sales-agi/node_modules/agi-node/lib/agi-channel.js:100:28) at AGIChannel.getVariable (/Users/mario.lenis/Dev/4sales-agi/node_modules/agi-node/lib/agi-channel.js:158:21)

Problem seems to be here. Line 51 on agi-server.js channel.on('request', function(req) { self.conn.write(req + '\n'); });