@routr/ctl 2.0.8-alpha.23 → 2.0.8-alpha.25
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/README.md +170 -51
- package/dist/base.d.ts +0 -1
- package/dist/base.js +0 -4
- package/dist/commands/acl/create.js +43 -43
- package/dist/commands/acl/describe.d.ts +10 -0
- package/dist/commands/acl/describe.js +62 -0
- package/dist/commands/acl/get.d.ts +1 -0
- package/dist/commands/acl/get.js +5 -20
- package/dist/commands/acl/update.js +43 -43
- package/dist/commands/agents/create.js +97 -97
- package/dist/commands/agents/describe.d.ts +10 -0
- package/dist/commands/agents/describe.js +72 -0
- package/dist/commands/agents/get.d.ts +1 -0
- package/dist/commands/agents/get.js +4 -26
- package/dist/commands/agents/update.js +88 -88
- package/dist/commands/credentials/describe.d.ts +10 -0
- package/dist/commands/credentials/describe.js +61 -0
- package/dist/commands/credentials/get.d.ts +1 -0
- package/dist/commands/credentials/get.js +5 -20
- package/dist/commands/credentials/update.js +39 -39
- package/dist/commands/domains/create.js +105 -105
- package/dist/commands/domains/describe.d.ts +10 -0
- package/dist/commands/domains/describe.js +78 -0
- package/dist/commands/domains/get.d.ts +1 -0
- package/dist/commands/domains/get.js +4 -24
- package/dist/commands/domains/update.js +99 -99
- package/dist/commands/numbers/create.js +88 -88
- package/dist/commands/numbers/describe.d.ts +10 -0
- package/dist/commands/numbers/describe.js +72 -0
- package/dist/commands/numbers/get.d.ts +1 -0
- package/dist/commands/numbers/get.js +4 -24
- package/dist/commands/numbers/update.js +69 -69
- package/dist/commands/peers/create.js +106 -97
- package/dist/commands/peers/describe.d.ts +10 -0
- package/dist/commands/peers/describe.js +80 -0
- package/dist/commands/peers/get.d.ts +1 -0
- package/dist/commands/peers/get.js +6 -43
- package/dist/commands/peers/update.js +103 -94
- package/dist/commands/trunks/create.js +143 -139
- package/dist/commands/trunks/describe.d.ts +10 -0
- package/dist/commands/trunks/describe.js +85 -0
- package/dist/commands/trunks/get.d.ts +1 -0
- package/dist/commands/trunks/get.js +6 -33
- package/dist/commands/trunks/update.js +146 -142
- package/dist/delete.js +8 -3
- package/oclif.manifest.json +267 -183
- package/package.json +8 -5
|
@@ -36,131 +36,137 @@ class UpdateCommand extends base_1.BaseCommand {
|
|
|
36
36
|
const { args, flags } = await this.parse(UpdateCommand);
|
|
37
37
|
const { endpoint, insecure } = flags;
|
|
38
38
|
const api = new sdk_1.default.Trunks({ endpoint, insecure });
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
39
|
+
try {
|
|
40
|
+
const trunkFromDB = await api.getTrunk(args.ref);
|
|
41
|
+
// TODO: Add support for pagination
|
|
42
|
+
const acls = await new sdk_1.default.ACL({ endpoint, insecure }).listACLs({
|
|
43
|
+
pageSize: 25,
|
|
44
|
+
pageToken: ""
|
|
45
|
+
});
|
|
46
|
+
const aclChoices = acls.items.map((acl) => {
|
|
47
|
+
return {
|
|
48
|
+
name: acl.name,
|
|
49
|
+
value: acl.ref
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
const credentials = await new sdk_1.default.Credentials({
|
|
53
|
+
endpoint,
|
|
54
|
+
insecure
|
|
55
|
+
}).listCredentials({
|
|
56
|
+
pageSize: 25,
|
|
57
|
+
pageToken: ""
|
|
58
|
+
});
|
|
59
|
+
const credentialsChoice = credentials.items.map((acl) => {
|
|
60
|
+
return {
|
|
61
|
+
name: acl.name,
|
|
62
|
+
value: acl.ref
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
this.log("This utility will help you update an existing Trunk.");
|
|
66
|
+
this.log("Press ^C at any time to quit.");
|
|
67
|
+
this.warn("Adding Outbound SIP URIs will delete existing ones.");
|
|
68
|
+
const group1 = await inquirer_1.default.prompt([
|
|
69
|
+
{
|
|
70
|
+
name: "name",
|
|
71
|
+
message: "Friendly Name",
|
|
72
|
+
type: "input",
|
|
73
|
+
default: trunkFromDB.name,
|
|
74
|
+
validate: validators_1.nameValidator
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "inboundUri",
|
|
78
|
+
message: "Inbound SIP URI",
|
|
79
|
+
type: "input",
|
|
80
|
+
validate: validators_1.inboundUriValidator,
|
|
81
|
+
default: trunkFromDB.inboundUri
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "accessControlListRef",
|
|
85
|
+
message: "IP Access Control List",
|
|
86
|
+
type: "list",
|
|
87
|
+
default: trunkFromDB.accessControlListRef,
|
|
88
|
+
choices: [{ name: "None", value: undefined }, ...aclChoices]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "inboundCredentialsRef",
|
|
92
|
+
message: "Inbound Credentials",
|
|
93
|
+
type: "list",
|
|
94
|
+
default: trunkFromDB.inboundCredentialsRef,
|
|
95
|
+
choices: [{ name: "None", value: undefined }, ...credentialsChoice]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "outboundCredentialsRef",
|
|
99
|
+
message: "Outbound Credentials",
|
|
100
|
+
type: "list",
|
|
101
|
+
default: trunkFromDB.outboundCredentialsRef,
|
|
102
|
+
choices: [{ name: "None", value: undefined }, ...credentialsChoice]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "sendRegister",
|
|
106
|
+
message: "Send Register?",
|
|
107
|
+
type: "confirm",
|
|
108
|
+
default: trunkFromDB.sendRegister
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "addOutboundUri",
|
|
112
|
+
message: "Add an Outbound SIP URI?",
|
|
113
|
+
type: "confirm",
|
|
114
|
+
default: false
|
|
115
|
+
}
|
|
116
|
+
]);
|
|
117
|
+
const group2Questions = [
|
|
118
|
+
{
|
|
119
|
+
name: "host",
|
|
120
|
+
message: "Host",
|
|
121
|
+
type: "input",
|
|
122
|
+
validate: validators_1.hostValidator
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "port",
|
|
126
|
+
message: "Post",
|
|
127
|
+
type: "input",
|
|
128
|
+
default: "5060",
|
|
129
|
+
validate: validators_1.portValidator
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "transport",
|
|
133
|
+
message: "Transport",
|
|
134
|
+
type: "list",
|
|
135
|
+
choices: [common_1.CommonTypes.Transport.UDP, common_1.CommonTypes.Transport.TCP, common_1.CommonTypes.Transport.TLS],
|
|
136
|
+
default: common_1.CommonTypes.Transport.UDP
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "user",
|
|
140
|
+
message: "User Part",
|
|
141
|
+
type: "input",
|
|
142
|
+
validate: validators_1.optionalUsernameValidator
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "priority",
|
|
146
|
+
message: "Priority",
|
|
147
|
+
type: "input",
|
|
148
|
+
default: "10",
|
|
149
|
+
validate: validators_1.priorityValidator
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "weight",
|
|
153
|
+
message: "Weight",
|
|
154
|
+
type: "input",
|
|
155
|
+
default: "10",
|
|
156
|
+
validate: validators_1.weightValidator
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "addOutboundUri",
|
|
160
|
+
message: "Add another Outbound SIP URI?",
|
|
161
|
+
type: "confirm",
|
|
162
|
+
default: false
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
let addOutboundUri = group1.addOutboundUri;
|
|
166
|
+
const uris = [];
|
|
167
|
+
// eslint-disable-next-line no-loops/no-loops
|
|
168
|
+
while (addOutboundUri) {
|
|
169
|
+
const group2 = await inquirer_1.default.prompt(group2Questions);
|
|
164
170
|
uris.push({
|
|
165
171
|
host: group2.host,
|
|
166
172
|
port: group2.port,
|
|
@@ -170,21 +176,19 @@ class UpdateCommand extends base_1.BaseCommand {
|
|
|
170
176
|
weight: group2.weight,
|
|
171
177
|
enabled: true
|
|
172
178
|
});
|
|
179
|
+
addOutboundUri = group2.addOutboundUri;
|
|
173
180
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
const group3 = await inquirer_1.default.prompt([
|
|
182
|
+
{
|
|
183
|
+
name: "confirm",
|
|
184
|
+
message: "Ready?",
|
|
185
|
+
type: "confirm"
|
|
186
|
+
}
|
|
187
|
+
]);
|
|
188
|
+
if (!group3.confirm) {
|
|
189
|
+
this.warn("Aborted");
|
|
181
190
|
}
|
|
182
|
-
|
|
183
|
-
if (!group3.confirm) {
|
|
184
|
-
this.warn("Aborted");
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
try {
|
|
191
|
+
else {
|
|
188
192
|
core_1.CliUx.ux.action.start(`Updating Trunk ${group1.name}`);
|
|
189
193
|
const trunk = await api.updateTrunk({
|
|
190
194
|
ref: trunkFromDB.ref,
|
|
@@ -194,10 +198,10 @@ class UpdateCommand extends base_1.BaseCommand {
|
|
|
194
198
|
await core_1.CliUx.ux.wait(1000);
|
|
195
199
|
core_1.CliUx.ux.action.stop(trunk.ref);
|
|
196
200
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
}
|
|
202
|
+
catch (e) {
|
|
203
|
+
core_1.CliUx.ux.action.stop();
|
|
204
|
+
throw new errors_1.CLIError(e.message);
|
|
201
205
|
}
|
|
202
206
|
}
|
|
203
207
|
}
|
package/dist/delete.js
CHANGED
|
@@ -31,9 +31,14 @@ class DeleteCommand extends base_1.BaseCommand {
|
|
|
31
31
|
throw new errors_1.CLIError("You must provide a resource ref before continuing");
|
|
32
32
|
}
|
|
33
33
|
core_1.CliUx.ux.action.start(`Deleting item ${args.ref}`);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
try {
|
|
35
|
+
await API[funcName](args.ref);
|
|
36
|
+
await core_1.CliUx.ux.wait(1000);
|
|
37
|
+
core_1.CliUx.ux.action.stop("Done");
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
throw new errors_1.CLIError(e.message);
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
async catch(err) {
|
|
39
44
|
return super.catch(err);
|