Skip to content

Commit

Permalink
New SIP routing API version preview/2021-05-01-preview (#14500)
Browse files Browse the repository at this point in the history
* sip routing API

* return 422 instead of 400

* change missing trunk error message

* add 'error' prefix in error examples

* describe patch behaviour

* use the standard Azure error

* remove unnecessary descriptions

* fix descriptions

* change fqdn max length

* remove locale from example params and change endpoint

* use the standard Azure error in examples

* unify tags

* use CommunicationServicesCommon/CommunicationErrorResponse

* refactor sip configuration patch into separate class

* fix CommunicationErrorResponse file path

* add x-ms-error-response flag

* add http errors schemas
  • Loading branch information
jannovak-msft authored Jun 14, 2021
1 parent 836f657 commit 3b84377
Show file tree
Hide file tree
Showing 8 changed files with 504 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
{
"swagger": "2.0",
"info": {
"title": "SipRouting Service",
"description": "SipRouting Service",
"contact": {
"email": "acsdevexdisc@microsoft.com"
},
"version": "2021-05-01-preview"
},
"paths": {
"/sip": {
"get": {
"tags": [
"SipConfiguration"
],
"summary": "Gets SIP configuration for resource.",
"operationId": "GetSipConfiguration",
"produces": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"$ref": "#/definitions/SipConfiguration"
}
},
"default": {
"description": "Failure",
"schema": {
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
},
"x-ms-error-response": true
}
},
"x-ms-examples": {
"Get SIP configuration for resource": {
"$ref": "./examples/GetSipConfiguration.json"
}
}
},
"patch": {
"tags": [
"SipConfiguration"
],
"summary": "Patches SIP configuration for resource.",
"operationId": "PatchSipConfiguration",
"consumes": [
"application/merge-patch+json"
],
"produces": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"in": "body",
"name": "body",
"description": "Configuration patch.",
"schema": {
"$ref": "#/definitions/SipConfigurationPatch"
}
}
],
"responses": {
"200": {
"description": "Patched configuration is returned.",
"schema": {
"$ref": "#/definitions/SipConfiguration"
}
},
"415": {
"description": "Unsupported media type of the patch.",
"schema": {
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
},
"x-ms-error-response": true
},
"422": {
"description": "If the request is empty, unprocessable or inconsistent with the stored data.",
"schema": {
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
},
"x-ms-error-response": true
},
"500": {
"description": "All other api errors.",
"schema": {
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
},
"x-ms-error-response": true
},
"default": {
"description": "Failure",
"schema": {
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
},
"x-ms-error-response": true
}
},
"x-ms-examples": {
"Patch SIP configuration for resource": {
"$ref": "./examples/PatchSipConfiguration.json"
}
}
}
}
},
"definitions": {
"Trunk": {
"description": "Represents a SIP trunk for routing calls. See RFC 4904.",
"required": [
"sipSignalingPort"
],
"type": "object",
"properties": {
"sipSignalingPort": {
"format": "int32",
"description": "Gets or sets SIP signaling port of the trunk.",
"type": "integer"
}
}
},
"TrunkPatch": {
"description": "Represents a SIP trunk patch.",
"type": "object",
"properties": {
"sipSignalingPort": {
"format": "int32",
"description": "Gets or sets SIP signaling port of the trunk.",
"type": "integer"
}
}
},
"TrunkRoute": {
"description": "Represents a trunk route for routing calls.",
"required": [
"name",
"numberPattern"
],
"type": "object",
"properties": {
"description": {
"description": "Gets or sets description of the route.",
"maxLength": 1024,
"type": "string"
},
"name": {
"description": "Gets or sets name of the route.",
"maxLength": 256,
"type": "string"
},
"numberPattern": {
"description": "Gets or sets regex number pattern for routing calls. .NET regex format is supported.\r\nThe regex should match only digits with an optional '+' prefix without spaces.\r\nI.e. \"^\\+[1-9][0-9]{3,23}$\".",
"maxLength": 1024,
"type": "string"
},
"trunks": {
"description": "Gets or sets list of SIP trunks for routing calls. Trunks are represented as FQDN.",
"maxLength": 250,
"type": "array",
"items": {
"type": "string"
}
}
}
},
"SipConfiguration": {
"description": "Represents a SIP configuration.\r\nWhen a call is being routed the routes are applied in the same order as in the routes list.\r\nA route is matched by its number pattern.\r\nCall is then directed into route's first available trunk, based on the order in the route's trunks list.",
"type": "object",
"properties": {
"trunks": {
"description": "SIP trunks for routing calls.\r\nMap key is trunk's FQDN (1-249 characters).",
"maxLength": 250,
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Trunk"
}
},
"routes": {
"description": "Trunk routes for routing calls.",
"maxLength": 250,
"type": "array",
"items": {
"$ref": "#/definitions/TrunkRoute"
}
}
}
},
"SipConfigurationPatch": {
"description": "Represents a SIP configuration patch.",
"type": "object",
"properties": {
"trunks": {
"description": "SIP trunks for routing calls.\r\nMap key is trunk's FQDN (1-249 characters).",
"maxLength": 250,
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/TrunkPatch"
}
},
"routes": {
"description": "Trunk routes for routing calls.",
"maxLength": 250,
"type": "array",
"items": {
"$ref": "#/definitions/TrunkRoute"
}
}
}
}
},
"parameters": {
"ApiVersionParameter": {
"in": "query",
"name": "api-version",
"description": "Version of API to invoke",
"required": true,
"type": "string"
},
"Endpoint": {
"in": "path",
"name": "endpoint",
"description": "The communication resource, for example https://resourcename.communication.azure.com",
"required": true,
"type": "string",
"x-ms-skip-url-encoding": true,
"x-ms-parameter-location": "client"
}
},
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"flow": "implicit",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"scopes": {
"user_impersonation": "impersonate your user account"
},
"description": "Azure Active Directory OAuth2 Flow"
}
},
"x-ms-parameterized-host": {
"hostTemplate": "{endpoint}",
"useSchemePrefix": false,
"parameters": [
{
"$ref": "#/parameters/Endpoint"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parameters": {
"api-version": "2021-05-01-preview",
"endpoint": "https://resourcename.communication.azure.com/"
},
"responses": {
"200": {
"headers": {},
"body": {
"trunks": {
"vendor.xyz.biz": {
"sipSignalingPort": 5061
},
"vendor.abc.biz": {
"sipSignalingPort": 5061
}
},
"routes": [
{
"name": "LocalRoute",
"numberPattern": "^\\+1[0-9]{10}$"
},
{
"name": "VendorXYZ",
"description": "External route XYZ",
"numberPattern": "^\\+?\\d+$",
"trunks": [
"vendor.xyz.biz"
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"parameters": {
"api-version": "2021-05-01-preview",
"body": {
"trunks": {
"vendor.xyz.biz": {
"sipSignalingPort": 5061
}
},
"routes": [
{
"name": "VendorXYZ",
"description": "External route XYZ",
"numberPattern": "^\\+?\\d+$",
"trunks": [
"vendor.xyz.biz"
]
}
]
},
"endpoint": "https://resourcename.communication.azure.com/"
},
"responses": {
"200": {
"headers": {},
"body": {
"trunks": {
"vendor.xyz.biz": {
"sipSignalingPort": 5061
}
},
"routes": [
{
"name": "VendorXYZ",
"description": "External route XYZ",
"numberPattern": "^\\+?\\d+$",
"trunks": [
"vendor.xyz.biz"
]
}
]
}
},
"415": {
"headers": {},
"body": {
"error": {
"code": "UnsupportedMediaType",
"message": "Unsupported Media Type."
}
}
},
"422": {
"headers": {},
"body": {
"error": {
"code": "UnprocessableEntity",
"message": "One or more request inputs are not valid.",
"innererror": {
"code": "InvalidRegex",
"message": "Unsupported regex format provided."
}
}
}
},
"500": {
"headers": {},
"body": {
"error": {
"code": "InternalError",
"message": "The server encountered an internal error."
}
}
}
}
}
15 changes: 15 additions & 0 deletions specification/communication/data-plane/SipRouting/readme.csharp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## C

These settings apply only when `--csharp` is specified on the command line.
Please also specify `--csharp-sdks-folder=<path to "SDKs" directory of your azure-sdk-for-net clone>`.

```yaml $(csharp)
csharp:
azure-arm: true
license-header: MICROSOFT_MIT_NO_VERSION
payload-flattening-threshold: 1
clear-output-folder: true
client-side-validation: false
namespace: Microsoft.CommunicationServices
output-folder: $(csharp-sdks-folder)/communicationservices/management/Microsoft.CommunicationServices/GeneratedProtocol
```
Loading

0 comments on commit 3b84377

Please sign in to comment.