
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
typescript-agi-ipcom
Advanced tools
Enhanced TypeScript library for Asterisk AGI (Asterisk Gateway Interface) with production-ready improvements
This is a fork of typescript-agi with significant reliability and functionality enhancements for production environments.
getData() with configurable delays between digit inputsgetQueueStats() and clearCommandQueue()channelAlive flag ensures proper connection state trackingnpm install typescript-agi-ipcom
import { AGIServer, Channel } from 'typescript-agi-ipcom';
const agiServer = new AGIServer(3000, '0.0.0.0');
agiServer.on('channel', async (channel: Channel) => {
try {
await channel.answer();
await channel.sayNumber(12345);
await channel.hangup();
} catch (error) {
console.error('Error handling channel:', error);
}
});
agiServer.start();
Collect multi-digit input with configurable inter-digit timeout:
agiServer.on('channel', async (channel: Channel) => {
await channel.answer();
// Collect up to 4 digits with 3-second timeout between digits
// Total timeout: 10 seconds after audio finishes
const result = await channel.getData(
'enter-account-number', // audio file
10000, // total timeout (10s)
4, // max digits
3000 // inter-digit timeout (3s)
);
if (result.timeout) {
await channel.streamFile('timeout');
} else {
await channel.verbose(`Collected: ${result.digits}`);
}
});
Override default timeouts for long-running operations:
// Execute Dial with custom 2-hour timeout
await channel.exec(
'Dial',
'PJSIP/user@trunk,3600,tT',
7200000 // 2 hours in milliseconds
);
// Use Infinity for no timeout (relies on channelAlive flag)
await channel.exec('Queue', 'support,,,,,', Infinity);
Monitor command queue health in real-time:
channel.on('commandQueued', ({ command, queueSize }) => {
console.log(`Queued: ${command}, Queue size: ${queueSize}`);
});
channel.on('commandProcessed', ({ command, duration }) => {
console.log(`Processed: ${command} in ${duration}ms`);
});
channel.on('commandFailed', ({ command, error }) => {
console.error(`Failed: ${command}`, error);
});
// Get current queue statistics
const stats = channel.getQueueStats();
console.log(`Queue: ${stats.size}, Processing: ${stats.isProcessing}`);
Commands automatically use appropriate timeouts based on their type:
| Command Type | Default Timeout | Examples |
|---|---|---|
| Fast commands | 10 seconds | ANSWER, HANGUP, GET/SET VARIABLE, DATABASE |
| Audio commands | 60 seconds | STREAM FILE, SAY, GET DATA, GET OPTION |
| Recording | 10 minutes | RECORD FILE |
| Call control | 6 hours | EXEC (Dial, Queue, VoiceMail) |
You can override any timeout by passing a custom value to methods that support it.
channel: New channel ready for interactionlistening: Server started successfullyerror: Server error occurredclose: Server stoppedStandard events:
ready: Channel initialized and ready for commandssend: Data sent to Asteriskrecv: Raw response received from Asteriskresponse: Parsed response objecthangup: Call hung upclose: Socket closederror: Socket errortimeout: Socket timeoutQueue management events:
commandQueued: Command added to queuecommandProcessed: Command completed successfullycommandFailed: Command execution failedqueueEmpty: All commands processedqueueCleared: Queue manually or automatically clearedFull API documentation is available in the TypeDoc documentation.
This fork includes the following enhancements:
FIFO Command Queue: Original had race condition issues with concurrent commands receiving wrong responses. Now uses sequential queue processing.
Intelligent Timeouts: Original used fixed 10-second timeout for all commands. Now uses context-aware timeouts (10s - 6 hours) based on command type.
Inter-Digit Timeout: Original getData() couldn't handle digit-by-digit collection with delays. New implementation supports configurable inter-digit timeouts.
Production Reliability:
channelAlive flag)Queue Management: New APIs for monitoring and controlling the command queue (getQueueStats(), clearCommandQueue()).
Enhanced Events: Additional events for command lifecycle tracking and queue management.
# Install dependencies
npm install
# Build ESM, CommonJS, and type definitions
npm run build
# Generate TypeDoc documentation
npm run docs
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Current Maintainer:
Original Author:
Copyright 2020 Brandon Lehmann (original work) Copyright 2025 Fabio Theodoro / IPCOM (enhancements)
This project is MIT licensed.
If this project helped you, please consider:
FAQs
NodeJS TypeScript Library for Asterisk AGI Interfaces
The npm package typescript-agi-ipcom receives a total of 0 weekly downloads. As such, typescript-agi-ipcom popularity was classified as not popular.
We found that typescript-agi-ipcom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.