typescript-agi-ipcom 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +72 -0
- package/dist/AGIServer.d.ts +49 -0
- package/dist/AGIServer.js +71 -0
- package/dist/Channel.d.ts +498 -0
- package/dist/Channel.js +1043 -0
- package/dist/ResponseArguments.d.ts +42 -0
- package/dist/ResponseArguments.js +79 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -0
- package/package.json +31 -0
- package/tsconfig.json +15 -0
- package/tslint.json +34 -0
- package/typedoc.json +10 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** @ignore */
|
|
2
|
+
export interface IResponseArguments {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string | number | boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Represents a set of AGI response arguments
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
10
|
+
export declare class ResponseArguments {
|
|
11
|
+
private m_args;
|
|
12
|
+
/**
|
|
13
|
+
* Adds a new argument to the set
|
|
14
|
+
* @param key
|
|
15
|
+
* @param value
|
|
16
|
+
*/
|
|
17
|
+
addArgument(key: string, value: string | number | boolean): void;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the requested key as a string
|
|
20
|
+
* @param key
|
|
21
|
+
*/
|
|
22
|
+
string(key: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the requested key as a number
|
|
25
|
+
* @param key
|
|
26
|
+
*/
|
|
27
|
+
number(key: string): number;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the request key as a boolean
|
|
30
|
+
* @param key
|
|
31
|
+
*/
|
|
32
|
+
boolean(key: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves the requested key from a character code
|
|
35
|
+
* @param key
|
|
36
|
+
*/
|
|
37
|
+
char(key: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves the value from the arguments that has no key, if it exists
|
|
40
|
+
*/
|
|
41
|
+
nokey(): string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2020, Brandon Lehmann
|
|
3
|
+
//
|
|
4
|
+
// Please see the included LICENSE file for more information.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ResponseArguments = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Represents a set of AGI response arguments
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
class ResponseArguments {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.m_args = [];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Adds a new argument to the set
|
|
17
|
+
* @param key
|
|
18
|
+
* @param value
|
|
19
|
+
*/
|
|
20
|
+
addArgument(key, value) {
|
|
21
|
+
this.m_args.push({ key, value });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the requested key as a string
|
|
25
|
+
* @param key
|
|
26
|
+
*/
|
|
27
|
+
string(key) {
|
|
28
|
+
for (const arg of this.m_args) {
|
|
29
|
+
if (arg.key === key) {
|
|
30
|
+
return arg.value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves the requested key as a number
|
|
37
|
+
* @param key
|
|
38
|
+
*/
|
|
39
|
+
number(key) {
|
|
40
|
+
for (const arg of this.m_args) {
|
|
41
|
+
if (arg.key === key) {
|
|
42
|
+
return parseInt(arg.value, 10);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the request key as a boolean
|
|
49
|
+
* @param key
|
|
50
|
+
*/
|
|
51
|
+
boolean(key) {
|
|
52
|
+
for (const arg of this.m_args) {
|
|
53
|
+
if (arg.key === key) {
|
|
54
|
+
return arg.value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Retrieves the requested key from a character code
|
|
61
|
+
* @param key
|
|
62
|
+
*/
|
|
63
|
+
char(key) {
|
|
64
|
+
const num = this.number(key);
|
|
65
|
+
return (num !== 0) ? String.fromCharCode(num) : '';
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Retrieves the value from the arguments that has no key, if it exists
|
|
69
|
+
*/
|
|
70
|
+
nokey() {
|
|
71
|
+
for (const arg of this.m_args) {
|
|
72
|
+
if (arg.key !== 'result' && arg.value) {
|
|
73
|
+
return arg.key;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.ResponseArguments = ResponseArguments;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2020, Brandon Lehmann
|
|
3
|
+
//
|
|
4
|
+
// Please see the included LICENSE file for more information.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var AGIServer_1 = require("./AGIServer");
|
|
7
|
+
Object.defineProperty(exports, "AGIServer", { enumerable: true, get: function () { return AGIServer_1.AGIServer; } });
|
|
8
|
+
var Channel_1 = require("./Channel");
|
|
9
|
+
Object.defineProperty(exports, "Channel", { enumerable: true, get: function () { return Channel_1.Channel; } });
|
|
10
|
+
Object.defineProperty(exports, "ChannelState", { enumerable: true, get: function () { return Channel_1.ChannelState; } });
|
|
11
|
+
Object.defineProperty(exports, "DialStatus", { enumerable: true, get: function () { return Channel_1.DialStatus; } });
|
|
12
|
+
Object.defineProperty(exports, "PlaybackStatus", { enumerable: true, get: function () { return Channel_1.PlaybackStatus; } });
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "typescript-agi-ipcom",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "NodeJS TypeScript Library for Asterisk AGI Interfaces",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "./node_modules/.bin/tsc",
|
|
9
|
+
"docs": "./node_modules/.bin/typedoc && touch docs/.nojekyll",
|
|
10
|
+
"fix-style": "./node_modules/.bin/tslint -c tslint.json --project . --fix",
|
|
11
|
+
"prepare": "npm run build",
|
|
12
|
+
"style": "./node_modules/.bin/tslint -c tslint.json --project .",
|
|
13
|
+
"test": "npm run style && npm run build"
|
|
14
|
+
},
|
|
15
|
+
"author": "Fábio Theodoro <fabio@ipcom.com.br>",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^13.13.14",
|
|
19
|
+
"tslint": "^6.1.2",
|
|
20
|
+
"typedoc": "^0.16.9",
|
|
21
|
+
"typescript": "^3.9.7"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/fabiotheo/typescript-agi.git"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/fabiotheo/typescript-agi#readme",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/fabiotheo/typescript-agi/issues"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/tsconfig.json
ADDED
package/tslint.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultSeverity": "error",
|
|
3
|
+
"extends": [
|
|
4
|
+
"tslint:latest"
|
|
5
|
+
],
|
|
6
|
+
"jsRules": {},
|
|
7
|
+
"rules": {
|
|
8
|
+
"quotemark": [
|
|
9
|
+
true,
|
|
10
|
+
"single"
|
|
11
|
+
],
|
|
12
|
+
"max-classes-per-file": false,
|
|
13
|
+
"interface-name": false,
|
|
14
|
+
"no-console": true,
|
|
15
|
+
"no-implicit-dependencies": [
|
|
16
|
+
true,
|
|
17
|
+
"dev"
|
|
18
|
+
],
|
|
19
|
+
"no-var-requires": false,
|
|
20
|
+
"prefer-object-spread": false,
|
|
21
|
+
"unified-signatures": false,
|
|
22
|
+
"object-literal-shorthand": false,
|
|
23
|
+
"ordered-imports": false,
|
|
24
|
+
"object-literal-sort-keys": false,
|
|
25
|
+
"variable-name": {
|
|
26
|
+
"options": [
|
|
27
|
+
"check-format",
|
|
28
|
+
"allow-pascal-case",
|
|
29
|
+
"allow-snake-case"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"rulesDirectory": []
|
|
34
|
+
}
|