@azure/communication-phone-numbers 1.3.0-beta.1 → 1.3.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +38 -31
- package/dist/index.js +547 -581
- package/dist/index.js.map +1 -1
- package/dist-esm/src/generated/src/lroImpl.js +1 -1
- package/dist-esm/src/generated/src/lroImpl.js.map +1 -1
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +295 -289
- package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/models/parameters.js +72 -68
- package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/operations/phoneNumbers.js +140 -162
- package/dist-esm/src/generated/src/operations/phoneNumbers.js.map +1 -1
- package/dist-esm/src/generated/src/operationsInterfaces/phoneNumbers.js.map +1 -1
- package/dist-esm/src/generated/src/pagingHelper.js.map +1 -1
- package/dist-esm/src/generated/src/phoneNumbersClient.js +5 -5
- package/dist-esm/src/generated/src/phoneNumbersClient.js.map +1 -1
- package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js +1 -1
- package/dist-esm/src/generated/src/siprouting/sipRoutingClientContext.js.map +1 -1
- package/dist-esm/src/generated/src/tracing.js +1 -1
- package/dist-esm/src/generated/src/tracing.js.map +1 -1
- package/dist-esm/src/mappers.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/phoneNumbersClient.js +4 -15
- package/dist-esm/src/phoneNumbersClient.js.map +1 -1
- package/dist-esm/src/sipRoutingClient.js +6 -16
- package/dist-esm/src/sipRoutingClient.js.map +1 -1
- package/dist-esm/src/utils/constants.js +1 -1
- package/dist-esm/src/utils/constants.js.map +1 -1
- package/dist-esm/src/utils/customPipelinePolicies.js.map +1 -1
- package/package.json +19 -20
- package/types/communication-phone-numbers.d.ts +6 -55
package/README.md
CHANGED
@@ -135,6 +135,7 @@ const client = new SipRoutingClient("<endpoint-from-resource>", credential);
|
|
135
135
|
The following sections provide code snippets that cover some of the common tasks using the Azure Communication Services Phone Numbers client. The scenarios that are covered here consist of:
|
136
136
|
|
137
137
|
PhoneNumbersClient
|
138
|
+
|
138
139
|
- [Search for available phone numbers](#search-for-available-phone-numbers)
|
139
140
|
- [Purchase phone numbers from a search](#purchase-phone-numbers-from-a-search)
|
140
141
|
- [Release a purchased phone number](#release-a-purchased-phone-number)
|
@@ -143,6 +144,7 @@ PhoneNumbersClient
|
|
143
144
|
- [List purchased phone numbers](#list-purchased-phone-numbers)
|
144
145
|
|
145
146
|
SipRoutingClient
|
147
|
+
|
146
148
|
- [Retrieve SIP trunks and routes](#retrieve-sip-trunks-and-routes)
|
147
149
|
- [Replace SIP trunks and routes](#replace-sip-trunks-and-routes)
|
148
150
|
- [Retrieve single trunk](#retrieve-single-trunk)
|
@@ -160,7 +162,7 @@ Use the `beginSearchAvailablePhoneNumbers` method to search for phone numbers an
|
|
160
162
|
```typescript
|
161
163
|
import {
|
162
164
|
PhoneNumbersClient,
|
163
|
-
SearchAvailablePhoneNumbersRequest
|
165
|
+
SearchAvailablePhoneNumbersRequest,
|
164
166
|
} from "@azure/communication-phone-numbers";
|
165
167
|
|
166
168
|
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
@@ -173,9 +175,9 @@ async function main() {
|
|
173
175
|
assignmentType: "application",
|
174
176
|
capabilities: {
|
175
177
|
sms: "outbound",
|
176
|
-
calling: "none"
|
178
|
+
calling: "none",
|
177
179
|
},
|
178
|
-
quantity: 1
|
180
|
+
quantity: 1,
|
179
181
|
};
|
180
182
|
|
181
183
|
const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);
|
@@ -196,27 +198,30 @@ Use the `beginPurchasePhoneNumbers` method to purchase the phone numbers from yo
|
|
196
198
|
`beginPurchasePhoneNumbers` is a long running operation and returns a poller.
|
197
199
|
|
198
200
|
```typescript
|
199
|
-
import {
|
201
|
+
import {
|
202
|
+
PhoneNumbersClient,
|
203
|
+
SearchAvailablePhoneNumbersRequest,
|
204
|
+
} from "@azure/communication-phone-numbers";
|
200
205
|
|
201
206
|
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
202
207
|
const client = new PhoneNumbersClient(connectionString);
|
203
208
|
|
204
209
|
async function main() {
|
205
|
-
const searchRequest = {
|
210
|
+
const searchRequest: SearchAvailablePhoneNumbersRequest = {
|
206
211
|
countryCode: "US",
|
207
212
|
phoneNumberType: "tollFree",
|
208
213
|
assignmentType: "application",
|
209
214
|
capabilities: {
|
210
215
|
sms: "outbound",
|
211
|
-
calling: "none"
|
216
|
+
calling: "none",
|
212
217
|
},
|
213
|
-
quantity: 1
|
218
|
+
quantity: 1,
|
214
219
|
};
|
215
220
|
|
216
221
|
const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);
|
217
222
|
|
218
223
|
// The search is underway. Wait to receive searchId.
|
219
|
-
const { searchId, phoneNumbers } = searchPoller.pollUntilDone();
|
224
|
+
const { searchId, phoneNumbers } = await searchPoller.pollUntilDone();
|
220
225
|
|
221
226
|
const purchasePoller = await client.beginPurchasePhoneNumbers(searchId);
|
222
227
|
|
@@ -262,7 +267,7 @@ Use the `beginUpdatePhoneNumberCapabilities` method to update the capabilities o
|
|
262
267
|
```typescript
|
263
268
|
import {
|
264
269
|
PhoneNumbersClient,
|
265
|
-
PhoneNumberCapabilitiesRequest
|
270
|
+
PhoneNumberCapabilitiesRequest,
|
266
271
|
} from "@azure/communication-phone-numbers";
|
267
272
|
|
268
273
|
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
@@ -274,7 +279,7 @@ async function main() {
|
|
274
279
|
// This will update phone number to send and receive sms, but only send calls.
|
275
280
|
const updateRequest: PhoneNumberCapabilitiesRequest = {
|
276
281
|
sms: "inbound+outbound",
|
277
|
-
calling: "outbound"
|
282
|
+
calling: "outbound",
|
278
283
|
};
|
279
284
|
|
280
285
|
const updatePoller = await client.beginUpdatePhoneNumberCapabilities(
|
@@ -300,7 +305,7 @@ import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
|
|
300
305
|
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
301
306
|
const client = new PhoneNumbersClient(connectionString);
|
302
307
|
|
303
|
-
async main
|
308
|
+
async function main() {
|
304
309
|
const phoneNumberToGet = "<phone-number-to-get>";
|
305
310
|
|
306
311
|
const phoneNumber = await client.getPurchasedPhoneNumber(phoneNumberToGet);
|
@@ -322,7 +327,7 @@ import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
|
|
322
327
|
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
323
328
|
const client = new PhoneNumbersClient(connectionString);
|
324
329
|
|
325
|
-
async main
|
330
|
+
async function main() {
|
326
331
|
const phoneNumbers = await client.listPurchasedPhoneNumbers();
|
327
332
|
|
328
333
|
for await (const phoneNumber of phoneNumbers) {
|
@@ -349,11 +354,11 @@ const client = new SipRoutingClient(connectionString);
|
|
349
354
|
async function main() {
|
350
355
|
const trunks = await client.listTrunks();
|
351
356
|
const routes = await client.listRoutes();
|
352
|
-
for await(const trunk of trunks) {
|
357
|
+
for await (const trunk of trunks) {
|
353
358
|
console.log(`Trunk ${trunk.fqdn}:${trunk.sipSignalingPort}`);
|
354
359
|
}
|
355
|
-
|
356
|
-
for await(const route of routes) {
|
360
|
+
|
361
|
+
for await (const route of routes) {
|
357
362
|
console.log(`Route ${route.name} with pattern ${route.numberPattern}`);
|
358
363
|
console.log(`Route's trunks: ${route.trunks?.join()}`);
|
359
364
|
}
|
@@ -375,26 +380,28 @@ const client = new SipRoutingClient(connectionString);
|
|
375
380
|
async function main() {
|
376
381
|
await client.setTrunks([
|
377
382
|
{
|
378
|
-
fqdn:
|
379
|
-
sipSignalingPort: 1234
|
380
|
-
},
|
381
|
-
|
382
|
-
|
383
|
-
|
383
|
+
fqdn: "sbc.one.domain.com",
|
384
|
+
sipSignalingPort: 1234,
|
385
|
+
},
|
386
|
+
{
|
387
|
+
fqdn: "sbc.two.domain.com",
|
388
|
+
sipSignalingPort: 1234,
|
389
|
+
},
|
384
390
|
]);
|
385
391
|
|
386
392
|
await client.setRoutes([
|
387
393
|
{
|
388
394
|
name: "First Route",
|
389
395
|
description: "route's description",
|
390
|
-
numberPattern: "
|
391
|
-
trunks: [
|
392
|
-
},
|
396
|
+
numberPattern: "^+[1-9][0-9]{3,23}$",
|
397
|
+
trunks: ["sbc.one.domain.com"],
|
398
|
+
},
|
399
|
+
{
|
393
400
|
name: "Second Route",
|
394
401
|
description: "route's description",
|
395
402
|
numberPattern: "^.*$",
|
396
|
-
trunks: [
|
397
|
-
}
|
403
|
+
trunks: ["sbc.two.domain.com", "sbc.one.domain.com"],
|
404
|
+
},
|
398
405
|
]);
|
399
406
|
}
|
400
407
|
|
@@ -410,11 +417,11 @@ const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
|
410
417
|
const client = new SipRoutingClient(connectionString);
|
411
418
|
|
412
419
|
async function main() {
|
413
|
-
const trunk = await client.getTrunk(
|
420
|
+
const trunk = await client.getTrunk("sbc.one.domain.com");
|
414
421
|
if (trunk) {
|
415
422
|
console.log(`Trunk ${trunk.fqdn}:${trunk.sipSignalingPort}`);
|
416
423
|
} else {
|
417
|
-
|
424
|
+
console.log("Trunk not found");
|
418
425
|
}
|
419
426
|
}
|
420
427
|
|
@@ -431,8 +438,8 @@ const client = new SipRoutingClient(connectionString);
|
|
431
438
|
|
432
439
|
async function main() {
|
433
440
|
await client.setTrunk({
|
434
|
-
fqdn:
|
435
|
-
sipSignalingPort: 4321
|
441
|
+
fqdn: "sbc.one.domain.com",
|
442
|
+
sipSignalingPort: 4321,
|
436
443
|
});
|
437
444
|
}
|
438
445
|
|
@@ -448,7 +455,7 @@ const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
|
448
455
|
const client = new SipRoutingClient(connectionString);
|
449
456
|
|
450
457
|
async function main() {
|
451
|
-
await client.deleteTrunk(
|
458
|
+
await client.deleteTrunk("sbc.one.domain.com");
|
452
459
|
}
|
453
460
|
|
454
461
|
main();
|