1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
use anyhow::Result;
use crate::Client;
pub struct SipConnectedAudio {
pub client: Client,
}
impl SipConnectedAudio {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
SipConnectedAudio { client }
}
/**
* List SIP trunk numbers.
*
* This function performs a `GET` to the `/sip_trunk/numbers` endpoint.
*
* With SIP-connected audio, Zoom establishes a SIP trunk (a network connection specifically designed to make and deliver phone calls) over a direct and private connection between the customer’s network and the Zoom cloud. Meeting participants that dial into a meeting or have the meeting call them, and are On-Net from the perspective of the customers' IP telephony network, will be connected over this trunk rather than over the PSTN. <br><br>Use this API to list all the numbers that are configured for SIP Connected Audio in a Zoom Account.
*
* **Prerequisites:**<br>
* * Pro or a higher account with SIP Connected Audio plan enabled.
* * The account must be a master account<br>
* **Scopes:** `sip_trunk:master`
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*/
pub async fn list_sip_trunk_numbers(
&self,
) -> Result<crate::types::ListSipTrunkNumbersResponse> {
let url = "/sip_trunk/numbers".to_string();
self.client.get(&url, None).await
}
/**
* Assign SIP trunk configuration.
*
* This function performs a `PATCH` to the `/accounts/{accountId}/sip_trunk/settings` endpoint.
*
* Use this API to copy the Session Initiation Protocol (SIP) Connected Audio configurations applied on the Master account and enable or disable those configurations on a subaccount.
*
* With SIP-connected audio, Zoom establishes a [SIP trunk](https://en.wikipedia.org/wiki/SIP_trunking) (a network connection specifically designed to make and deliver phone calls) over a direct and private connection between the customer’s network and the Zoom cloud. Meeting participants that dial into a meeting or have the meeting call them, and are On-Net from the perspective of the customers' IP telephony network, will be connected over this trunk rather than over the PSTN.
*
* **Scopes:** `sip_trunk:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
* **Prerequisites:**
* * Pro or a higher account with SIP Connected Audio plan enabled.
* * A Master account owner
*/
pub async fn assign_sip_config(
&self,
account_id: &str,
body: &crate::types::AssignSipConfigRequest,
) -> Result<()> {
let url = format!(
"/accounts/{}/sip_trunk/settings",
crate::progenitor_support::encode_path(account_id),
);
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Assign numbers.
*
* This function performs a `POST` to the `/accounts/{accountId}/sip_trunk/numbers` endpoint.
*
* With SIP-connected audio, Zoom establishes a SIP trunk (a network connection specifically designed to make and deliver phone calls) over a direct and private connection between the customer’s network and the Zoom cloud. Meeting participants that dial into a meeting or have the meeting call them, and are On-Net from the perspective of the customers' IP telephony network, will be connected over this trunk rather than over the PSTN. <br><br>Use this API to assign internal numbers to a sub account.
*
* **Prerequisites:**<br>
* * Pro or a higher account with SIP Connected Audio plan enabled.
* * The account must be a master account<br>
* **Scopes:** `sip_trunk:master`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
*
* **Parameters:**
*
* * `account_id: &str` -- Unique Identifier of the sub account.
*/
pub async fn assign_sip_trunk_numbers(
&self,
account_id: &str,
body: &crate::types::AssignSipTrunkNumbersRequest,
) -> Result<()> {
let url = format!(
"/accounts/{}/sip_trunk/numbers",
crate::progenitor_support::encode_path(account_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Delete all numbers.
*
* This function performs a `DELETE` to the `/accounts/{accountId}/sip_trunk/numbers` endpoint.
*
* With SIP-connected audio, Zoom establishes a SIP trunk (a network connection specifically designed to make and deliver phone calls) over a direct and private connection between the customer’s network and the Zoom cloud. Meeting participants that dial into a meeting or have the meeting call them, and are On-Net from the perspective of the customers' IP telephony network, will be connected over this trunk rather than over the PSTN. <br><br>Use this API to delete all internal numbers assigned to a sub account.
* **Prerequisites:**<br>
*
* * Pro or a higher account with SIP Connected Audio plan enabled.
* * The account must be a master account<br>
* **Scopes:** `sip_trunk:master`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
* **Parameters:**
*
* * `account_id: &str` -- Account ID of the sub account from which the numbers are to be deleted. This can be retrieved from [List sub accounts](https://marketplace.zoom.us/docs/api-reference/zoom-api/accounts/account) API.
*/
pub async fn delete_all_sip_numbers(&self, account_id: &str) -> Result<()> {
let url = format!(
"/accounts/{}/sip_trunk/numbers",
crate::progenitor_support::encode_path(account_id),
);
self.client.delete(&url, None).await
}
/**
* List SIP trunks.
*
* This function performs a `GET` to the `/accounts/{accountId}/sip_trunk/trunks` endpoint.
*
* With SIP-connected audio, Zoom establishes a SIP trunk (a network connection specifically designed to make and deliver phone calls) over a direct and private connection between the customer’s network and the Zoom cloud. Meeting participants that dial into a meeting or have the meeting call them, and are On-Net from the perspective of the customers’ IP telephony network, will be connected over this trunk rather than over the PSTN.<br><br>
* Use this API to list all the SIP trunks assigned to a master account or a sub account of the master account. To retrieve SIP trunks assigned to a sub account, provide the account ID of the sub account in the `accountId` path parameter. To retrieve SIP trunks of a master account, provide `me` as the value of the `accountId` path parameter. <br><br> **Scope:** `sip_trunk:read:admin`
* <br><b>Prerequisites:</b><br>
* * The account must either be a master account or a sub account with [API Partner Plan](https://zoom.us/plan/api) and SIP Connected Audio Plan.
*
* **Parameters:**
*
* * `account_id: &str` -- Unique Identifier of the Account. To retrieve SIP trunks assigned to a sub account, provide the account ID of the sub account in the as the value of this field. To retrieve SIP trunks of a master account, provide `me` as the value of this field.
*/
pub async fn list_sip_trunk(
&self,
account_id: &str,
) -> Result<crate::types::ListSipTrunksResponseData> {
let url = format!(
"/accounts/{}/sip_trunk/trunks",
crate::progenitor_support::encode_path(account_id),
);
self.client.get(&url, None).await
}
/**
* Assign SIP trunks.
*
* This function performs a `POST` to the `/accounts/{accountId}/sip_trunk/trunks` endpoint.
*
* With SIP-connected audio, Zoom establishes a SIP trunk (a network connection specifically designed to make and deliver phone calls) over a direct and private connection between the customer’s network and the Zoom cloud. Meeting participants that dial into a meeting or have the meeting call them, and are On-Net from the perspective of the customers’ IP telephony network, will be connected over this trunk rather than over the PSTN.<br><br>Use this API to assign SIP trunk(s) that are available on a master account to a sub account. <br><b>Prerequisites:</b><br>
* * The account making this API request must be a master account with [API Partner Plan](https://zoom.us/plan/api) and SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
* **Parameters:**
*
* * `account_id: &str` -- Unique Identifier of the sub account.
*/
pub async fn assign_sip_trunks(
&self,
account_id: &str,
body: &crate::types::AssignSipTrunksRequestData,
) -> Result<crate::types::AssignSipTrunksResponseData> {
let url = format!(
"/accounts/{}/sip_trunk/trunks",
crate::progenitor_support::encode_path(account_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Delete a SIP trunk.
*
* This function performs a `DELETE` to the `/accounts/{accountId}/sip_trunk/trunks/{trunkId}` endpoint.
*
* Use this API to remove existing SIP trunk of a sub account.<br>
* <br><b>Prerequisites:</b><br>
* * The account making this API request must be a master account with [API Partner Plan](https://zoom.us/plan/api) and SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
* **Parameters:**
*
* * `account_id: &str` -- Unique identifier of the sub account.
* * `trunk_id: &str` -- Unique identifier of the SIP Trunk that was previously assigned to a sub account. To retrieve the value of this field, use the List SIP Trunks API.
*/
pub async fn delete_sip_trunk(
&self,
account_id: &str,
trunk_id: &str,
) -> Result<crate::types::Domains> {
let url = format!(
"/accounts/{}/sip_trunk/trunks/{}",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(trunk_id),
);
self.client.delete(&url, None).await
}
/**
* List internal call-out countries.
*
* This function performs a `GET` to the `/accounts/{accountId}/sip_trunk/callout_countries` endpoint.
*
* Retrieve the list of internal [call-out](https://support.zoom.us/hc/en-us/articles/200942859-How-To-Use-Telephone-Call-Out-) countries of a master account or a sub account. To list call-out enabled countries of a sub account, provide the account ID of the sub account in the `accountId` path parameter. To list call-out enabled countries of a master account, provide `me` as the value of the `accountId` path parameter.
* <br><b>Prerequisites:</b><br>
* * The account making this API request must be a [master account](https://marketplace.zoom.us/docs/api-reference/master-account-apis) with SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
* **Parameters:**
*
* * `account_id: &str` -- Unique identifier of the account. To list Call-out enabled countries to a sub account, provide the account ID of the sub account in the `accountId` path parameter. To list Call-out enabled countries of a sub account, provide the account ID of the sub account in the `accountId` path parameter. To list Call-out enabled countries of a master account, provide `me` as the value of the `accountId` path parameter.
*/
pub async fn list_internal_callout_countries(
&self,
account_id: &str,
) -> Result<crate::types::ListInternalCalloutCountriesResponse> {
let url = format!(
"/accounts/{}/sip_trunk/callout_countries",
crate::progenitor_support::encode_path(account_id),
);
self.client.get(&url, None).await
}
/**
* Add internal call-out countries.
*
* This function performs a `POST` to the `/accounts/{accountId}/sip_trunk/callout_countries` endpoint.
*
* Specify the list of [call-out](https://support.zoom.us/hc/en-us/articles/200942859-How-To-Use-Telephone-Call-Out-) countries for a master account or a sub account. To add call-out enabled countries to a sub account, provide the account ID of the sub account in the `accountId` path parameter. To add call-out enabled countries to a master account, provide `me` as the value of the `accountId` path parameter.
* <br><b>Prerequisites:</b><br>
* * The account making this API request must be a [master account](https://marketplace.zoom.us/docs/api-reference/master-account-apis) with SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
* **Parameters:**
*
* * `account_id: &str` -- Unique identifier of the account. To add Call-out enabled countries to a sub account, provide the account ID of the sub account in the `accountId` path parameter. To add Call-out enabled countries to a master account, provide `me` as the value of the `accountId` path parameter.
*/
pub async fn add_callout_countries(
&self,
account_id: &str,
body: &crate::types::AddCalloutCountriesRequestData,
) -> Result<crate::types::AddCalloutCountriesResponse> {
let url = format!(
"/accounts/{}/sip_trunk/callout_countries",
crate::progenitor_support::encode_path(account_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Delete internal call-out country.
*
* This function performs a `DELETE` to the `/accounts/{accountId}/sip_trunk/callout_countries/{countryId}` endpoint.
*
* Delete a previously assigned [call-out](https://support.zoom.us/hc/en-us/articles/200942859-How-To-Use-Telephone-Call-Out-) country from a master account or a sub account. To remove call-out country from a sub account, provide the account ID of the sub account in the `accountId` path parameter. To remove call-out country from a master account, provide `me` as the value of the `accountId` path parameter.
* <br><b>Prerequisites:</b><br>
* * The account making this API request must be a [master account](https://marketplace.zoom.us/docs/api-reference/master-account-apis) with SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
* **Parameters:**
*
* * `account_id: &str` -- Unique Identifier of the Account.<br>
* To remove Call-out country from a sub account, provide the account ID of the sub account in the `accountId` path parameter. To remove Call-out country from a master account, provide `me` as the value of the `accountId` path parameter.
* * `country_id: &str` -- Two lettered Id of the country.
*/
pub async fn delete_internal_call_out_country(
&self,
account_id: &str,
country_id: &str,
) -> Result<()> {
let url = format!(
"/accounts/{}/sip_trunk/callout_countries/{}",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(country_id),
);
self.client.delete(&url, None).await
}
/**
* List internal numbers.
*
* This function performs a `GET` to the `/accounts/{accountId}/sip_trunk/internal_numbers` endpoint.
*
* This API allows a master account with SIP Connected Audio plan to list internal phone numbers (i.e., numbers that are not provided by Zoom but are owned by the organization consuming the API) assigned to a master account or a sub account.<br><br>To list internal numbers of a sub account, provide the account ID of the sub account in the `accountId` path parameter. To list internal numbers of a master account, provide `me` as the value of the `accountId` path parameter.
* <br><b>Prerequisites:</b><br>
* * The account making this API request must be a [master account](https://marketplace.zoom.us/docs/api-reference/master-account-apis) with SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
*
*
*
* **Parameters:**
*
* * `account_id: &str` -- Unique identifier of the account. To list internal numbers of a sub account, provide the account ID of the sub account in the `accountId` path parameter. To list internal numbers of a master account, provide `me` as the value of the `accountId` path parameter.
* * `page_size: i64` -- The number of records returned within a single API call.
* * `next_page_token: &str` -- The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes.
*/
pub async fn list_internal_numbers(
&self,
account_id: &str,
page_size: i64,
next_page_token: &str,
) -> Result<Vec<crate::types::InternalNumbers>> {
let mut query_args: Vec<(String, String)> = Default::default();
if !next_page_token.is_empty() {
query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
}
if page_size > 0 {
query_args.push(("page_size".to_string(), page_size.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!(
"/accounts/{}/sip_trunk/internal_numbers?{}",
crate::progenitor_support::encode_path(account_id),
query_
);
let resp: crate::types::ListInternalNumbersResponse = self.client.get(&url, None).await?;
// Return our response data.
Ok(resp.internal_numbers.to_vec())
}
/**
* List internal numbers.
*
* This function performs a `GET` to the `/accounts/{accountId}/sip_trunk/internal_numbers` endpoint.
*
* As opposed to `list_internal_numbers`, this function returns all the pages of the request at once.
*
* This API allows a master account with SIP Connected Audio plan to list internal phone numbers (i.e., numbers that are not provided by Zoom but are owned by the organization consuming the API) assigned to a master account or a sub account.<br><br>To list internal numbers of a sub account, provide the account ID of the sub account in the `accountId` path parameter. To list internal numbers of a master account, provide `me` as the value of the `accountId` path parameter.
* <br><b>Prerequisites:</b><br>
* * The account making this API request must be a [master account](https://marketplace.zoom.us/docs/api-reference/master-account-apis) with SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
*
*
*/
pub async fn list_all_internal_numbers(
&self,
account_id: &str,
) -> Result<Vec<crate::types::InternalNumbers>> {
let url = format!(
"/accounts/{}/sip_trunk/internal_numbers",
crate::progenitor_support::encode_path(account_id),
);
let mut resp: crate::types::ListInternalNumbersResponse =
self.client.get(&url, None).await?;
let mut internal_numbers = resp.internal_numbers;
let mut page = resp.next_page_token;
// Paginate if we should.
while !page.is_empty() {
// Check if we already have URL params and need to concat the token.
if !url.contains('?') {
resp = self
.client
.get(&format!("{}?next_page_token={}", url, page), None)
.await?;
} else {
resp = self
.client
.get(&format!("{}&next_page_token={}", url, page), None)
.await?;
}
internal_numbers.append(&mut resp.internal_numbers);
if !resp.next_page_token.is_empty() && resp.next_page_token != page {
page = resp.next_page_token.to_string();
} else {
page = "".to_string();
}
}
// Return our response data.
Ok(internal_numbers)
}
/**
* Add internal numbers.
*
* This function performs a `POST` to the `/accounts/{accountId}/sip_trunk/internal_numbers` endpoint.
*
* This API allows a master account with SIP Connected Audio plan to assign internal phone numbers (i.e., numbers that are not provided by Zoom but are owned by the organization consuming the API) to a master account or a sub account.<br><br>To add internal numbers to a sub account, provide the account ID of the sub account in the `accountId` path parameter. To add internal numbers to a master account, provide `me` as the value of the `accountId` path parameter.
* <br><b>Prerequisites:</b><br>
* * The account making this API request must be a [master account](https://marketplace.zoom.us/docs/api-reference/master-account-apis) with SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
*
*
* **Parameters:**
*
* * `account_id: &str` -- Unique identifier of the account.<br>To add internal numbers to a sub account, provide the account ID of the sub account in the `accountId` path parameter. To add internal numbers to a master account, provide `me` as the value of the `accountId` path parameter.
*/
pub async fn add_internal_numbers(
&self,
account_id: &str,
body: &crate::types::AddInternalNumbersRequest,
) -> Result<crate::types::AddInternalNumbersResponseData> {
let url = format!(
"/accounts/{}/sip_trunk/internal_numbers",
crate::progenitor_support::encode_path(account_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Delete an internal number.
*
* This function performs a `DELETE` to the `/accounts/{accountId}/sip_trunk/internal_numbers/{numberId}` endpoint.
*
* This API allows a master account with SIP Connected Audio plan to delete a previously assigned internal phone number from a master account or a sub account.<br><br>To delete an internal number from a sub account, provide the account ID of the sub account in the `accountId` path parameter. To delete an internal number from a master account, provide `me` as the value of the `accountId` path parameter.
* <br><b>Prerequisites:</b><br>
* * The account making this API request must be a [master account](https://marketplace.zoom.us/docs/api-reference/master-account-apis) with SIP Connected Audio Plan.<br><br>
* **Scope:** `sip_trunk:master`
*
*
*
*
* **Parameters:**
*
* * `account_id: &str` -- Unique Identifier of the account. To delete an internal number from a sub account, provide the account ID of the sub account in the `accountId` path parameter. To delete an internal number from a master account, provide `me` as the value of the `accountId` path parameter.
* * `number_id: &str` -- Unique identifier of the phone number. This value can be retrieved by calling the List Internal Numbers API.
*/
pub async fn delete_internal_number(&self, account_id: &str, number_id: &str) -> Result<()> {
let url = format!(
"/accounts/{}/sip_trunk/internal_numbers/{}",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(number_id),
);
self.client.delete(&url, None).await
}
}