@azure/communication-phone-numbers 1.3.0-alpha.20250122.7 → 1.3.0-alpha.20250129.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +165 -186
- package/dist/browser/generated/src/lroImpl.d.ts.map +1 -1
- package/dist/browser/generated/src/lroImpl.js +0 -7
- package/dist/browser/generated/src/lroImpl.js.map +1 -1
- package/dist/browser/phoneNumbersClient.d.ts +141 -50
- package/dist/browser/phoneNumbersClient.d.ts.map +1 -1
- package/dist/browser/phoneNumbersClient.js +141 -50
- package/dist/browser/phoneNumbersClient.js.map +1 -1
- package/dist/commonjs/generated/src/lroImpl.d.ts.map +1 -1
- package/dist/commonjs/generated/src/lroImpl.js +0 -7
- package/dist/commonjs/generated/src/lroImpl.js.map +1 -1
- package/dist/commonjs/phoneNumbersClient.d.ts +141 -50
- package/dist/commonjs/phoneNumbersClient.d.ts.map +1 -1
- package/dist/commonjs/phoneNumbersClient.js +141 -50
- package/dist/commonjs/phoneNumbersClient.js.map +1 -1
- package/dist/esm/generated/src/lroImpl.d.ts.map +1 -1
- package/dist/esm/generated/src/lroImpl.js +0 -7
- package/dist/esm/generated/src/lroImpl.js.map +1 -1
- package/dist/esm/phoneNumbersClient.d.ts +141 -50
- package/dist/esm/phoneNumbersClient.d.ts.map +1 -1
- package/dist/esm/phoneNumbersClient.js +141 -50
- package/dist/esm/phoneNumbersClient.js.map +1 -1
- package/dist/react-native/generated/src/lroImpl.d.ts.map +1 -1
- package/dist/react-native/generated/src/lroImpl.js +0 -7
- package/dist/react-native/generated/src/lroImpl.js.map +1 -1
- package/dist/react-native/phoneNumbersClient.d.ts +141 -50
- package/dist/react-native/phoneNumbersClient.d.ts.map +1 -1
- package/dist/react-native/phoneNumbersClient.js +141 -50
- package/dist/react-native/phoneNumbersClient.js.map +1 -1
- package/package.json +16 -16
package/README.md
CHANGED
@@ -70,14 +70,14 @@ Once you have a key, you can authenticate the client with any of the following m
|
|
70
70
|
|
71
71
|
### Using a connection string
|
72
72
|
|
73
|
-
```
|
73
|
+
```ts snippet:ReadmeSampleCreatePhoneClient_ConnectionString
|
74
74
|
import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
|
75
75
|
|
76
76
|
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
77
77
|
const client = new PhoneNumbersClient(connectionString);
|
78
78
|
```
|
79
79
|
|
80
|
-
```
|
80
|
+
```ts snippet:ReadmeSampleCreateSipClient_ConnectionString
|
81
81
|
import { SipRoutingClient } from "@azure/communication-phone-numbers";
|
82
82
|
|
83
83
|
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
@@ -88,7 +88,7 @@ const client = new SipRoutingClient(connectionString);
|
|
88
88
|
|
89
89
|
If you use a key to initialize the client you will also need to provide the appropriate endpoint. You can get this endpoint from your Communication Services resource in [Azure Portal][azure_portal]. Once you have a key and endpoint, you can authenticate with the following code:
|
90
90
|
|
91
|
-
```
|
91
|
+
```ts snippet:ReadmeSampleCreatePhoneClient_KeyCredential
|
92
92
|
import { AzureKeyCredential } from "@azure/core-auth";
|
93
93
|
import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
|
94
94
|
|
@@ -96,7 +96,7 @@ const credential = new AzureKeyCredential("<key-from-resource>");
|
|
96
96
|
const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
|
97
97
|
```
|
98
98
|
|
99
|
-
```
|
99
|
+
```ts snippet:ReadmeSampleCreateSipClient_KeyCredential
|
100
100
|
import { AzureKeyCredential } from "@azure/core-auth";
|
101
101
|
import { SipRoutingClient } from "@azure/communication-phone-numbers";
|
102
102
|
|
@@ -114,7 +114,7 @@ npm install @azure/identity
|
|
114
114
|
|
115
115
|
The [`@azure/identity`][azure_identity] package provides a variety of credential types that your application can use to do this. The [README for `@azure/identity`][azure_identity_readme] provides more details and samples to get you started.
|
116
116
|
|
117
|
-
```
|
117
|
+
```ts snippet:ReadmeSampleCreatePhoneClient_DefaultAzureCredential
|
118
118
|
import { DefaultAzureCredential } from "@azure/identity";
|
119
119
|
import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
|
120
120
|
|
@@ -122,7 +122,7 @@ const credential = new DefaultAzureCredential();
|
|
122
122
|
const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
|
123
123
|
```
|
124
124
|
|
125
|
-
```
|
125
|
+
```ts snippet:ReadmeSampleCreateSipClient_DefaultAzureCredential
|
126
126
|
import { DefaultAzureCredential } from "@azure/identity";
|
127
127
|
import { SipRoutingClient } from "@azure/communication-phone-numbers";
|
128
128
|
|
@@ -159,36 +159,33 @@ Use the `beginSearchAvailablePhoneNumbers` method to search for phone numbers an
|
|
159
159
|
|
160
160
|
`beginSearchAvailablePhoneNumbers` is a long running operation and returns a poller.
|
161
161
|
|
162
|
-
```
|
162
|
+
```ts snippet:PhoneNumbersClientSearchAvailablePhoneNumbers
|
163
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
163
164
|
import {
|
164
165
|
PhoneNumbersClient,
|
165
166
|
SearchAvailablePhoneNumbersRequest,
|
166
167
|
} from "@azure/communication-phone-numbers";
|
167
168
|
|
168
|
-
const
|
169
|
-
const client = new PhoneNumbersClient(
|
170
|
-
|
171
|
-
async function main() {
|
172
|
-
const searchRequest: SearchAvailablePhoneNumbersRequest = {
|
173
|
-
countryCode: "US",
|
174
|
-
phoneNumberType: "tollFree",
|
175
|
-
assignmentType: "application",
|
176
|
-
capabilities: {
|
177
|
-
sms: "outbound",
|
178
|
-
calling: "none",
|
179
|
-
},
|
180
|
-
quantity: 1,
|
181
|
-
};
|
182
|
-
|
183
|
-
const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);
|
184
|
-
|
185
|
-
// The search is underway. Wait to receive searchId.
|
186
|
-
const searchResults = await searchPoller.pollUntilDone();
|
187
|
-
console.log(`Found phone number: ${searchResults.phoneNumbers[0]}`);
|
188
|
-
console.log(`searchId: ${searchResults.searchId}`);
|
189
|
-
}
|
169
|
+
const credential = new DefaultAzureCredential();
|
170
|
+
const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
|
190
171
|
|
191
|
-
|
172
|
+
const searchRequest: SearchAvailablePhoneNumbersRequest = {
|
173
|
+
countryCode: "US",
|
174
|
+
phoneNumberType: "tollFree",
|
175
|
+
assignmentType: "application",
|
176
|
+
capabilities: {
|
177
|
+
sms: "outbound",
|
178
|
+
calling: "none",
|
179
|
+
},
|
180
|
+
quantity: 1,
|
181
|
+
};
|
182
|
+
|
183
|
+
const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);
|
184
|
+
|
185
|
+
// The search is underway. Wait to receive searchId.
|
186
|
+
const searchResults = await searchPoller.pollUntilDone();
|
187
|
+
console.log(`Found phone number: ${searchResults.phoneNumbers[0]}`);
|
188
|
+
console.log(`searchId: ${searchResults.searchId}`);
|
192
189
|
```
|
193
190
|
|
194
191
|
#### Purchase phone numbers from a search
|
@@ -197,40 +194,37 @@ Use the `beginPurchasePhoneNumbers` method to purchase the phone numbers from yo
|
|
197
194
|
|
198
195
|
`beginPurchasePhoneNumbers` is a long running operation and returns a poller.
|
199
196
|
|
200
|
-
```
|
197
|
+
```ts snippet:PhoneNumbersClientPurchasePhoneNumbers
|
198
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
201
199
|
import {
|
202
200
|
PhoneNumbersClient,
|
203
201
|
SearchAvailablePhoneNumbersRequest,
|
204
202
|
} from "@azure/communication-phone-numbers";
|
205
203
|
|
206
|
-
const
|
207
|
-
const client = new PhoneNumbersClient(
|
208
|
-
|
209
|
-
async function main() {
|
210
|
-
const searchRequest: SearchAvailablePhoneNumbersRequest = {
|
211
|
-
countryCode: "US",
|
212
|
-
phoneNumberType: "tollFree",
|
213
|
-
assignmentType: "application",
|
214
|
-
capabilities: {
|
215
|
-
sms: "outbound",
|
216
|
-
calling: "none",
|
217
|
-
},
|
218
|
-
quantity: 1,
|
219
|
-
};
|
204
|
+
const credential = new DefaultAzureCredential();
|
205
|
+
const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
|
220
206
|
|
221
|
-
|
207
|
+
const searchRequest: SearchAvailablePhoneNumbersRequest = {
|
208
|
+
countryCode: "US",
|
209
|
+
phoneNumberType: "tollFree",
|
210
|
+
assignmentType: "application",
|
211
|
+
capabilities: {
|
212
|
+
sms: "outbound",
|
213
|
+
calling: "none",
|
214
|
+
},
|
215
|
+
quantity: 1,
|
216
|
+
};
|
222
217
|
|
223
|
-
|
224
|
-
const { searchId, phoneNumbers } = await searchPoller.pollUntilDone();
|
218
|
+
const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);
|
225
219
|
|
226
|
-
|
220
|
+
// The search is underway. Wait to receive searchId.
|
221
|
+
const { searchId, phoneNumbers } = await searchPoller.pollUntilDone();
|
227
222
|
|
228
|
-
|
229
|
-
await purchasePoller.pollUntilDone();
|
230
|
-
console.log(`Successfully purchased ${phoneNumbers[0]}`);
|
231
|
-
}
|
223
|
+
const purchasePoller = await client.beginPurchasePhoneNumbers(searchId);
|
232
224
|
|
233
|
-
|
225
|
+
// Purchase is underway.
|
226
|
+
await purchasePoller.pollUntilDone();
|
227
|
+
console.log(`Successfully purchased ${phoneNumbers[0]}`);
|
234
228
|
```
|
235
229
|
|
236
230
|
#### Release a purchased phone number
|
@@ -239,23 +233,20 @@ Use the `beginReleasePhoneNumber` method to release a previously purchased phone
|
|
239
233
|
|
240
234
|
`beginReleasePhoneNumber` is a long running operation and returns a poller.
|
241
235
|
|
242
|
-
```
|
236
|
+
```ts snippet:PhoneNumbersClientReleasePhoneNumber
|
237
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
243
238
|
import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
|
244
239
|
|
245
|
-
const
|
246
|
-
const client = new PhoneNumbersClient(
|
240
|
+
const credential = new DefaultAzureCredential();
|
241
|
+
const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
|
247
242
|
|
248
|
-
|
249
|
-
const phoneNumberToRelease = "<phone-number-to-release>";
|
243
|
+
const phoneNumberToRelease = "<phone-number-to-release>";
|
250
244
|
|
251
|
-
|
245
|
+
const releasePoller = await client.beginReleasePhoneNumber(phoneNumberToRelease);
|
252
246
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
}
|
257
|
-
|
258
|
-
main();
|
247
|
+
// Release is underway.
|
248
|
+
await releasePoller.pollUntilDone();
|
249
|
+
console.log("Successfully release phone number.");
|
259
250
|
```
|
260
251
|
|
261
252
|
#### Update phone number capabilities
|
@@ -264,79 +255,70 @@ Use the `beginUpdatePhoneNumberCapabilities` method to update the capabilities o
|
|
264
255
|
|
265
256
|
`beginUpdatePhoneNumberCapabilities` is a long running operation and returns a poller.
|
266
257
|
|
267
|
-
```
|
258
|
+
```ts snippet:PhoneNumbersClientUpdatePhoneNumberCapabilities
|
259
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
268
260
|
import {
|
269
261
|
PhoneNumbersClient,
|
270
262
|
PhoneNumberCapabilitiesRequest,
|
271
263
|
} from "@azure/communication-phone-numbers";
|
272
264
|
|
273
|
-
const
|
274
|
-
const client = new PhoneNumbersClient(
|
275
|
-
|
276
|
-
async function main() {
|
277
|
-
const phoneNumberToUpdate = "<phone-number-to-update>";
|
265
|
+
const credential = new DefaultAzureCredential();
|
266
|
+
const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
|
278
267
|
|
279
|
-
|
280
|
-
const updateRequest: PhoneNumberCapabilitiesRequest = {
|
281
|
-
sms: "inbound+outbound",
|
282
|
-
calling: "outbound",
|
283
|
-
};
|
268
|
+
const phoneNumberToUpdate = "<phone-number-to-update>";
|
284
269
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
270
|
+
// This will update phone number to send and receive sms, but only send calls.
|
271
|
+
const updateRequest: PhoneNumberCapabilitiesRequest = {
|
272
|
+
sms: "inbound+outbound",
|
273
|
+
calling: "outbound",
|
274
|
+
};
|
289
275
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
276
|
+
const updatePoller = await client.beginUpdatePhoneNumberCapabilities(
|
277
|
+
phoneNumberToUpdate,
|
278
|
+
updateRequest,
|
279
|
+
);
|
294
280
|
|
295
|
-
|
281
|
+
// Update is underway.
|
282
|
+
const { capabilities } = await updatePoller.pollUntilDone();
|
283
|
+
console.log(`These are the update capabilities: ${capabilities}`);
|
296
284
|
```
|
297
285
|
|
298
286
|
#### Get a purchased phone number
|
299
287
|
|
300
288
|
Use the `getPurchasedPhoneNumber` method to get information about a purchased phone number. This information includes the phone number's type, capabilities, cost, and purchase date.
|
301
289
|
|
302
|
-
```
|
290
|
+
```ts snippet:PhoneNumbersClientGetPurchasedPhoneNumber
|
291
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
303
292
|
import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
|
304
293
|
|
305
|
-
const
|
306
|
-
const client = new PhoneNumbersClient(
|
307
|
-
|
308
|
-
async function main() {
|
309
|
-
const phoneNumberToGet = "<phone-number-to-get>";
|
294
|
+
const credential = new DefaultAzureCredential();
|
295
|
+
const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
|
310
296
|
|
311
|
-
|
297
|
+
const phoneNumberToGet = "<phone-number-to-get>";
|
312
298
|
|
313
|
-
|
314
|
-
console.log(`Phone number type is ${phoneNumber.phoneNumberType}`);
|
315
|
-
}
|
299
|
+
const phoneNumber = await client.getPurchasedPhoneNumber(phoneNumberToGet);
|
316
300
|
|
317
|
-
|
301
|
+
console.log(`The id is the same as the phone number: ${phoneNumber.id}`);
|
302
|
+
console.log(`Phone number type is ${phoneNumber.phoneNumberType}`);
|
318
303
|
```
|
319
304
|
|
320
305
|
#### List purchased phone numbers
|
321
306
|
|
322
307
|
Use the `listPurchasedPhoneNumbers` method to page through all purchased phone numbers.
|
323
308
|
|
324
|
-
```
|
309
|
+
```ts snippet:PhoneNumbersClientListPurchasedPhoneNumbers
|
310
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
325
311
|
import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
|
326
312
|
|
327
|
-
const
|
328
|
-
const client = new PhoneNumbersClient(
|
313
|
+
const credential = new DefaultAzureCredential();
|
314
|
+
const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
|
329
315
|
|
330
|
-
|
331
|
-
const phoneNumbers = await client.listPurchasedPhoneNumbers();
|
316
|
+
const phoneNumbers = client.listPurchasedPhoneNumbers();
|
332
317
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
}
|
318
|
+
for await (const phoneNumber of phoneNumbers) {
|
319
|
+
console.log(`The id is the same as the phone number: ${phoneNumber.id}`);
|
320
|
+
console.log(`Phone number type is ${phoneNumber.phoneNumberType}`);
|
337
321
|
}
|
338
|
-
|
339
|
-
main();
|
340
322
|
```
|
341
323
|
|
342
324
|
### SipRoutingClient
|
@@ -345,124 +327,121 @@ main();
|
|
345
327
|
|
346
328
|
Get the list of currently configured trunks or routes.
|
347
329
|
|
348
|
-
```
|
330
|
+
```ts snippet:SipRoutingClientRetrieveTrunksAndRoutes
|
331
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
349
332
|
import { SipRoutingClient } from "@azure/communication-phone-numbers";
|
350
333
|
|
351
|
-
const
|
352
|
-
const client = new SipRoutingClient(
|
334
|
+
const credential = new DefaultAzureCredential();
|
335
|
+
const client = new SipRoutingClient("<endpoint-from-resource>", credential);
|
353
336
|
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
console.log(`Trunk ${trunk.fqdn}:${trunk.sipSignalingPort}`);
|
359
|
-
}
|
360
|
-
|
361
|
-
for await (const route of routes) {
|
362
|
-
console.log(`Route ${route.name} with pattern ${route.numberPattern}`);
|
363
|
-
console.log(`Route's trunks: ${route.trunks?.join()}`);
|
364
|
-
}
|
337
|
+
const trunks = client.listTrunks();
|
338
|
+
const routes = client.listRoutes();
|
339
|
+
for await (const trunk of trunks) {
|
340
|
+
console.log(`Trunk ${trunk.fqdn}:${trunk.sipSignalingPort}`);
|
365
341
|
}
|
366
342
|
|
367
|
-
|
343
|
+
for await (const route of routes) {
|
344
|
+
console.log(`Route ${route.name} with pattern ${route.numberPattern}`);
|
345
|
+
console.log(`Route's trunks: ${route.trunks?.join()}`);
|
346
|
+
}
|
368
347
|
```
|
369
348
|
|
370
349
|
#### Replace SIP trunks and routes
|
371
350
|
|
372
351
|
Replace the list of currently configured trunks or routes with new values.
|
373
352
|
|
374
|
-
```
|
353
|
+
```ts snippet:SipRoutingClientReplaceTrunksAndRoutes
|
354
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
375
355
|
import { SipRoutingClient } from "@azure/communication-phone-numbers";
|
376
356
|
|
377
|
-
const
|
378
|
-
const client = new SipRoutingClient(
|
379
|
-
|
380
|
-
async function main() {
|
381
|
-
await client.setTrunks([
|
382
|
-
{
|
383
|
-
fqdn: "sbc.one.domain.com",
|
384
|
-
sipSignalingPort: 1234,
|
385
|
-
},
|
386
|
-
{
|
387
|
-
fqdn: "sbc.two.domain.com",
|
388
|
-
sipSignalingPort: 1234,
|
389
|
-
},
|
390
|
-
]);
|
391
|
-
|
392
|
-
await client.setRoutes([
|
393
|
-
{
|
394
|
-
name: "First Route",
|
395
|
-
description: "route's description",
|
396
|
-
numberPattern: "^+[1-9][0-9]{3,23}$",
|
397
|
-
trunks: ["sbc.one.domain.com"],
|
398
|
-
},
|
399
|
-
{
|
400
|
-
name: "Second Route",
|
401
|
-
description: "route's description",
|
402
|
-
numberPattern: "^.*$",
|
403
|
-
trunks: ["sbc.two.domain.com", "sbc.one.domain.com"],
|
404
|
-
},
|
405
|
-
]);
|
406
|
-
}
|
357
|
+
const credential = new DefaultAzureCredential();
|
358
|
+
const client = new SipRoutingClient("<endpoint-from-resource>", credential);
|
407
359
|
|
408
|
-
|
360
|
+
await client.setTrunks([
|
361
|
+
{
|
362
|
+
fqdn: "sbc.one.domain.com",
|
363
|
+
sipSignalingPort: 1234,
|
364
|
+
},
|
365
|
+
{
|
366
|
+
fqdn: "sbc.two.domain.com",
|
367
|
+
sipSignalingPort: 1234,
|
368
|
+
},
|
369
|
+
]);
|
370
|
+
|
371
|
+
await client.setRoutes([
|
372
|
+
{
|
373
|
+
name: "First Route",
|
374
|
+
description: "route's description",
|
375
|
+
numberPattern: "^+[1-9][0-9]{3,23}$",
|
376
|
+
trunks: ["sbc.one.domain.com"],
|
377
|
+
},
|
378
|
+
{
|
379
|
+
name: "Second Route",
|
380
|
+
description: "route's description",
|
381
|
+
numberPattern: "^.*$",
|
382
|
+
trunks: ["sbc.two.domain.com", "sbc.one.domain.com"],
|
383
|
+
},
|
384
|
+
]);
|
409
385
|
```
|
410
386
|
|
411
387
|
#### Retrieve single trunk
|
412
388
|
|
413
|
-
```
|
389
|
+
```ts snippet:SipRoutingClientRetrieveSingleTrunk
|
390
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
414
391
|
import { SipRoutingClient } from "@azure/communication-phone-numbers";
|
415
392
|
|
416
|
-
const
|
417
|
-
const client = new SipRoutingClient(
|
393
|
+
const credential = new DefaultAzureCredential();
|
394
|
+
const client = new SipRoutingClient("<endpoint-from-resource>", credential);
|
418
395
|
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
console.log("Trunk not found");
|
425
|
-
}
|
396
|
+
const trunk = await client.getTrunk("sbc.one.domain.com");
|
397
|
+
if (trunk) {
|
398
|
+
console.log(`Trunk ${trunk.fqdn}:${trunk.sipSignalingPort}`);
|
399
|
+
} else {
|
400
|
+
console.log("Trunk not found");
|
426
401
|
}
|
427
|
-
|
428
|
-
main();
|
429
402
|
```
|
430
403
|
|
431
404
|
#### Set single trunk
|
432
405
|
|
433
|
-
```
|
406
|
+
```ts snippet:SipRoutingClientSetSingleTrunk
|
407
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
434
408
|
import { SipRoutingClient } from "@azure/communication-phone-numbers";
|
435
409
|
|
436
|
-
const
|
437
|
-
const client = new SipRoutingClient(
|
438
|
-
|
439
|
-
async function main() {
|
440
|
-
await client.setTrunk({
|
441
|
-
fqdn: "sbc.one.domain.com",
|
442
|
-
sipSignalingPort: 4321,
|
443
|
-
});
|
444
|
-
}
|
410
|
+
const credential = new DefaultAzureCredential();
|
411
|
+
const client = new SipRoutingClient("<endpoint-from-resource>", credential);
|
445
412
|
|
446
|
-
|
413
|
+
await client.setTrunk({
|
414
|
+
fqdn: "sbc.one.domain.com",
|
415
|
+
sipSignalingPort: 4321,
|
416
|
+
});
|
447
417
|
```
|
448
418
|
|
449
419
|
#### Delete single trunk
|
450
420
|
|
451
|
-
```
|
421
|
+
```ts snippet:SipRoutingClientDeleteSingleTrunk
|
422
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
452
423
|
import { SipRoutingClient } from "@azure/communication-phone-numbers";
|
453
424
|
|
454
|
-
const
|
455
|
-
const client = new SipRoutingClient(
|
456
|
-
|
457
|
-
async function main() {
|
458
|
-
await client.deleteTrunk("sbc.one.domain.com");
|
459
|
-
}
|
425
|
+
const credential = new DefaultAzureCredential();
|
426
|
+
const client = new SipRoutingClient("<endpoint-from-resource>", credential);
|
460
427
|
|
461
|
-
|
428
|
+
await client.deleteTrunk("sbc.one.domain.com");
|
462
429
|
```
|
463
430
|
|
464
431
|
## Troubleshooting
|
465
432
|
|
433
|
+
### Logging
|
434
|
+
|
435
|
+
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
436
|
+
|
437
|
+
```ts snippet:SetLogLevel
|
438
|
+
import { setLogLevel } from "@azure/logger";
|
439
|
+
|
440
|
+
setLogLevel("info");
|
441
|
+
```
|
442
|
+
|
443
|
+
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
444
|
+
|
466
445
|
## Next steps
|
467
446
|
|
468
447
|
Please take a look at the
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lroImpl.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"lroImpl.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEpE,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE;IACvC,eAAe,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE;QACJ,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzB,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAmB1B"}
|
@@ -1,10 +1,3 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
3
|
-
* Licensed under the MIT License.
|
4
|
-
*
|
5
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
6
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
7
|
-
*/
|
8
1
|
import { __rest } from "tslib";
|
9
2
|
export function createLroSpec(inputs) {
|
10
3
|
const { args, spec, sendOperationFn } = inputs;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":";AAUA,MAAM,UAAU,aAAa,CAAI,MAQhC;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAC/C,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,UAAU;QAC9B,WAAW,EAAE,IAAI,CAAC,IAAK;QACvB,kBAAkB,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;QACrD,eAAe,EAAE,CACf,IAAY,EACZ,OAA2C,EAC3C,EAAE;YACF,MAAM,EAAE,WAAW,KAAkB,IAAI,EAAjB,QAAQ,UAAK,IAAI,EAAnC,eAA4B,CAAO,CAAC;YAC1C,OAAO,eAAe,CAAC,IAAI,kCACtB,QAAQ,KACX,UAAU,EAAE,KAAK,EACjB,IAAI,EACJ,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,IACjC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { LongRunningOperation, LroResponse } from \"@azure/core-lro\";\n\nexport function createLroSpec<T>(inputs: {\n sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;\n args: Record<string, unknown>;\n spec: {\n readonly requestBody?: unknown;\n readonly path?: string;\n readonly httpMethod: string;\n } & Record<string, any>;\n}): LongRunningOperation<T> {\n const { args, spec, sendOperationFn } = inputs;\n return {\n requestMethod: spec.httpMethod,\n requestPath: spec.path!,\n sendInitialRequest: () => sendOperationFn(args, spec),\n sendPollRequest: (\n path: string,\n options?: { abortSignal?: AbortSignalLike },\n ) => {\n const { requestBody, ...restSpec } = spec;\n return sendOperationFn(args, {\n ...restSpec,\n httpMethod: \"GET\",\n path,\n abortSignal: options?.abortSignal,\n });\n },\n };\n}\n"]}
|