Socket
Socket
Sign inDemoInstall

asteriskjs

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asteriskjs - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

lib/.DS_Store

2

lib/class/agiHandler/connectionHandler/connectionHandler.d.ts
/// <reference types="node" />
/// <reference types="node" />
import { EventEmitter } from 'events';

@@ -31,2 +32,3 @@ import { Socket } from 'net';

setVariable(name: string, value: string | number | boolean): Promise<AGIAnswerObject>;
getVariable(name: string): Promise<AGIAnswerObject>;
exec(application: string, options?: string): Promise<AGIAnswerObject>;

@@ -33,0 +35,0 @@ goSub(extension: string, priority: number, context?: string, args?: string): Promise<AGIAnswerObject>;

@@ -151,2 +151,5 @@ "use strict";

}
async getVariable(name) {
return await this.sendCommand(`GET VARIABLE ${name}`);
}
async exec(application, options) {

@@ -153,0 +156,0 @@ return await this.sendCommand(`EXEC ${application} ${options}`);

4

lib/class/agiHandler/connectionHandler/interfaces.d.ts

@@ -34,3 +34,3 @@ /// <reference types="node" />

}
export declare type CommandQueue = CommandObject[];
export declare type validationFNC<T extends AGIAnswerObject> = (response: AGIAnswerObject) => response is T;
export type CommandQueue = CommandObject[];
export type validationFNC<T extends AGIAnswerObject> = (response: AGIAnswerObject) => response is T;
import { AgiConnectionHandlerFunctionArgument } from './agiConnectionHandlerFunctionArgument.interface';
export declare type AgiConnectionHandlerFunction = (system: AgiConnectionHandlerFunctionArgument) => Promise<void>;
export type AgiConnectionHandlerFunction = (system: AgiConnectionHandlerFunctionArgument) => Promise<void>;
export default AgiConnectionHandlerFunction;

@@ -5,14 +5,7 @@ /// <reference types="node" />

import LogFunction from '../../../interfaces/logFunction.interface';
import AgiConnectionHandlerFunction from './agiConnectionHandlerFunction.interface';
interface AgiConfigDefault {
import AgiConnectionHandlerFunction from '../connectionHandler/interfaces/agiConnectionHandlerFunction.interface';
export interface AgiConfig extends TcpNetConnectOpts {
readonly handler: AgiConnectionHandlerFunction;
readonly log?: LogConfig | LogFunction;
}
export interface AgiConfigTCP extends TcpNetConnectOpts, AgiConfigDefault {
readonly type: 'tcp';
}
export interface AgiConfigStdIn extends AgiConfigDefault {
readonly type: 'cli';
}
export declare type AgiConfig = AgiConfigTCP | AgiConfigStdIn;
export default AgiConfig;
/// <reference types="node" />
import AgiConnectionHandler from '../agiConnectionHandler';
import connectionHandler from '../connectionHandler/connectionHandler';
import { createServer } from 'net';
import { ServerDependencies } from '../../serverHandler/interfaces/serverDependencies.interface';
import CLIConnection from '../connections/cliConnection.class';
export interface AgiServerDependencies extends ServerDependencies {
AgiConnectionHandler: typeof AgiConnectionHandler;
connections: {
cli: typeof CLIConnection;
tcp: typeof createServer;
};
createServer: typeof createServer;
connectionHandler: typeof connectionHandler;
}
/// <reference types="hapi__joi" />
import * as joi from '@hapi/joi';
export declare const AgiConfigTCP: joi.ObjectSchema<any>;
export declare const AgiConfigStdIn: joi.ObjectSchema<any>;
export declare const AgiConfig: joi.AlternativesSchema;
export default AgiConfig;
declare const _default: joi.ObjectSchema<any>;
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgiConfig = exports.AgiConfigStdIn = exports.AgiConfigTCP = void 0;
const joi = require("@hapi/joi");
exports.AgiConfigTCP = joi.object().keys({
exports.default = joi.object().keys({
allowHalfOpen: joi.boolean().optional(),

@@ -20,11 +19,3 @@ family: joi.string().optional(),

writable: joi.boolean().optional(),
type: joi.valid('tcp').required(),
});
exports.AgiConfigStdIn = joi.object().keys({
type: joi.valid('cli').required(),
log: joi.alternatives().try(joi.func(), joi.object()).optional(),
handler: joi.function().required(),
});
exports.AgiConfig = joi.alternatives().try(exports.AgiConfigTCP, exports.AgiConfigStdIn);
exports.default = exports.AgiConfig;
//# sourceMappingURL=agiConfig.schema.js.map
import AmiResponse from './amiResponse.interface';
declare type basicTypes = string | number | boolean;
type basicTypes = string | number | boolean;
export interface AmiCommand {

@@ -4,0 +4,0 @@ id: string;

@@ -1,2 +0,2 @@

export declare type ChannelState = 'Down' | 'Rsrvd' | 'OffHook' | 'Dialing' | 'Ring' | 'Ringing' | 'Up' | 'Busy' | 'Dialing Offhook' | 'Pre-ring' | 'unknown';
export type ChannelState = 'Down' | 'Rsrvd' | 'OffHook' | 'Dialing' | 'Ring' | 'Ringing' | 'Up' | 'Busy' | 'Dialing Offhook' | 'Pre-ring' | 'unknown';
export default ChannelState;

@@ -1,2 +0,2 @@

export declare type Serverity = 'Informational' | 'Error';
export type Serverity = 'Informational' | 'Error';
export default Serverity;

@@ -28,10 +28,10 @@ "use strict";

return {
emerg: (...args) => log('emerg', ...args),
alert: (...args) => log('alert', ...args),
crit: (...args) => log('crit', ...args),
err: (...args) => log('err', ...args),
warning: (...args) => log('warning', ...args),
notice: (...args) => log('notice', ...args),
info: (...args) => log('info', ...args),
debug: (...args) => log('debug', ...args),
emerg: log,
alert: log,
crit: log,
err: log,
warning: log,
notice: log,
info: log,
debug: log,
};

@@ -38,0 +38,0 @@ }

import { HandlerDependencies } from './interfaces';
import agiHandler from './class/agiHandler/agiHandler';
import amiHandler from './class/amiHandler/amiHandler';

@@ -7,4 +8,4 @@ export default class {

static Factory(): default;
agi(opts: unknown): Promise<void>;
agi(opts: unknown): Promise<agiHandler>;
ami(opts: unknown): Promise<amiHandler>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const agiConnectionEstablisher_1 = require("./class/agiHandler/agiConnectionEstablisher");
const agiHandler_1 = require("./class/agiHandler/agiHandler");
const amiHandler_1 = require("./class/amiHandler/amiHandler");

@@ -11,3 +11,3 @@ class default_1 {

return new this({
AgiConnectionEstablisher: agiConnectionEstablisher_1.default,
agiHandler: agiHandler_1.default,
amiHandler: amiHandler_1.default,

@@ -17,8 +17,8 @@ });

async agi(opts) {
if (this.deps.AgiConnectionEstablisher.validateConfig(opts)) {
const agiHandler = this.deps.AgiConnectionEstablisher.Factory(opts);
if (this.deps.agiHandler.validateConfig(opts)) {
const agiHandler = this.deps.agiHandler.Factory(opts);
return agiHandler.init();
}
else {
throw this.deps.AgiConnectionEstablisher.getValidationErrors(opts);
throw this.deps.agiHandler.getValidationErrors(opts);
}

@@ -25,0 +25,0 @@ }

@@ -7,5 +7,5 @@ import handler from './handler';

export { DefaultAmiEvent } from './class/amiHandler/interfaces/amiEvent.interface';
export { AgiConnectionHandlerFunctionArgument } from './class/agiHandler/interfaces/agiConnectionHandlerFunctionArgument.interface';
export { AgiConnectionHandlerFunction } from './class/agiHandler/interfaces/agiConnectionHandlerFunction.interface';
export { AgiConnectionEstablisher } from './class/agiHandler/agiConnectionEstablisher';
export { AgiConnectionHandlerFunctionArgument } from './class/agiHandler/connectionHandler/interfaces/agiConnectionHandlerFunctionArgument.interface';
export { AgiConnectionHandlerFunction } from './class/agiHandler/connectionHandler/interfaces/agiConnectionHandlerFunction.interface';
export { AgiHandler } from './class/agiHandler/agiHandler';
export { AmiHandler } from './class/amiHandler/amiHandler';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AmiHandler = exports.AgiConnectionEstablisher = void 0;
exports.AmiHandler = exports.AgiHandler = void 0;
const handler_1 = require("./handler");
exports.default = handler_1.default.Factory();
var agiConnectionEstablisher_1 = require("./class/agiHandler/agiConnectionEstablisher");
Object.defineProperty(exports, "AgiConnectionEstablisher", { enumerable: true, get: function () { return agiConnectionEstablisher_1.AgiConnectionEstablisher; } });
var agiHandler_1 = require("./class/agiHandler/agiHandler");
Object.defineProperty(exports, "AgiHandler", { enumerable: true, get: function () { return agiHandler_1.AgiHandler; } });
var amiHandler_1 = require("./class/amiHandler/amiHandler");
Object.defineProperty(exports, "AmiHandler", { enumerable: true, get: function () { return amiHandler_1.AmiHandler; } });
//# sourceMappingURL=index.js.map

@@ -1,6 +0,6 @@

import AgiConnectionEstablisher from './class/agiHandler/agiConnectionEstablisher';
import agiHandler from './class/agiHandler/agiHandler';
import amiHandler from './class/amiHandler/amiHandler';
export interface HandlerDependencies {
AgiConnectionEstablisher: typeof AgiConnectionEstablisher;
agiHandler: typeof agiHandler;
amiHandler: typeof amiHandler;
}

@@ -1,4 +0,4 @@

export declare type LogFunction = (msg: string | Error, data?: {
export type LogFunction = (msg: string | Error, data?: {
[key: string]: any;
}, ...args: any[]) => void;
export default LogFunction;
{
"name": "asteriskjs",
"version": "0.2.3",
"version": "0.2.4",
"description": "Fully Functional client for Asterisk's AMI and AGI.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -11,10 +11,4 @@ # AsteriskJS

However I'm still busy with improving the package, I'm using it already in a production environment. This doesn't mean
that the package is the best choice for all projects, but you can defently give it a try. I you miss some features or
you find some bugs. Please feel free to contribute by making a Pull request or just report it. I will do my best to improve
the project as neceserry.
## Documentation
### Setup
However we're using this package already internally. This package isn't ready for production yet. We're currently in
the development stage. So please don't use this package in production environments. We're trying to bring this
package as soon as possible to a stable version. Please stay tuned until then.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc