Skip to content

Commit

Permalink
Updated build
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey McFadden committed Jan 16, 2024
1 parent eb7ca36 commit 9fde46c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,21 @@ class AGIServer extends events_1.default.EventEmitter {
_bind() {
try {
this.fAGI = net.createServer((socket) => {
const remoteServer = (socket === null || socket === void 0 ? void 0 : socket.remoteAddress) ? socket.remoteAddress.split(":").pop() || false : false;
const remoteServer = (socket === null || socket === void 0 ? void 0 : socket.remoteAddress)
? socket.remoteAddress.split(":").pop() || false
: false;
let dataBuffer = "";
socket.on("data", (data) => __awaiter(this, void 0, void 0, function* () {
dataBuffer += data.toString();
if (dataBuffer.includes("\n\n")) {
socket.removeAllListeners("data");
const agiVariables = dataBuffer.split("\n").reduce((acc, line) => {
const agiVariables = dataBuffer
.split("\n")
.reduce((acc, line) => {
if (line.startsWith("agi_")) {
const [key, value] = line.split(":").map((item) => item.trim());
const [key, value] = line
.split(":")
.map((item) => item.trim());
acc[key.substring(4)] = value;
}
return acc;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asteriskagi",
"version": "1.0.0",
"version": "1.0.1",
"description": "NodeJS Fast AGI Server",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 9fde46c

Please sign in to comment.