Skip to content

Commit 3b84377

Browse files
New SIP routing API version preview/2021-05-01-preview (#14500)
* 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
1 parent 836f657 commit 3b84377

File tree

8 files changed

+504
-0
lines changed

8 files changed

+504
-0
lines changed
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "SipRouting Service",
5+
"description": "SipRouting Service",
6+
"contact": {
7+
"email": "[email protected]"
8+
},
9+
"version": "2021-05-01-preview"
10+
},
11+
"paths": {
12+
"/sip": {
13+
"get": {
14+
"tags": [
15+
"SipConfiguration"
16+
],
17+
"summary": "Gets SIP configuration for resource.",
18+
"operationId": "GetSipConfiguration",
19+
"produces": [
20+
"application/json"
21+
],
22+
"parameters": [
23+
{
24+
"$ref": "#/parameters/ApiVersionParameter"
25+
}
26+
],
27+
"responses": {
28+
"200": {
29+
"description": "Ok.",
30+
"schema": {
31+
"$ref": "#/definitions/SipConfiguration"
32+
}
33+
},
34+
"default": {
35+
"description": "Failure",
36+
"schema": {
37+
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
38+
},
39+
"x-ms-error-response": true
40+
}
41+
},
42+
"x-ms-examples": {
43+
"Get SIP configuration for resource": {
44+
"$ref": "./examples/GetSipConfiguration.json"
45+
}
46+
}
47+
},
48+
"patch": {
49+
"tags": [
50+
"SipConfiguration"
51+
],
52+
"summary": "Patches SIP configuration for resource.",
53+
"operationId": "PatchSipConfiguration",
54+
"consumes": [
55+
"application/merge-patch+json"
56+
],
57+
"produces": [
58+
"application/json"
59+
],
60+
"parameters": [
61+
{
62+
"$ref": "#/parameters/ApiVersionParameter"
63+
},
64+
{
65+
"in": "body",
66+
"name": "body",
67+
"description": "Configuration patch.",
68+
"schema": {
69+
"$ref": "#/definitions/SipConfigurationPatch"
70+
}
71+
}
72+
],
73+
"responses": {
74+
"200": {
75+
"description": "Patched configuration is returned.",
76+
"schema": {
77+
"$ref": "#/definitions/SipConfiguration"
78+
}
79+
},
80+
"415": {
81+
"description": "Unsupported media type of the patch.",
82+
"schema": {
83+
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
84+
},
85+
"x-ms-error-response": true
86+
},
87+
"422": {
88+
"description": "If the request is empty, unprocessable or inconsistent with the stored data.",
89+
"schema": {
90+
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
91+
},
92+
"x-ms-error-response": true
93+
},
94+
"500": {
95+
"description": "All other api errors.",
96+
"schema": {
97+
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
98+
},
99+
"x-ms-error-response": true
100+
},
101+
"default": {
102+
"description": "Failure",
103+
"schema": {
104+
"$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
105+
},
106+
"x-ms-error-response": true
107+
}
108+
},
109+
"x-ms-examples": {
110+
"Patch SIP configuration for resource": {
111+
"$ref": "./examples/PatchSipConfiguration.json"
112+
}
113+
}
114+
}
115+
}
116+
},
117+
"definitions": {
118+
"Trunk": {
119+
"description": "Represents a SIP trunk for routing calls. See RFC 4904.",
120+
"required": [
121+
"sipSignalingPort"
122+
],
123+
"type": "object",
124+
"properties": {
125+
"sipSignalingPort": {
126+
"format": "int32",
127+
"description": "Gets or sets SIP signaling port of the trunk.",
128+
"type": "integer"
129+
}
130+
}
131+
},
132+
"TrunkPatch": {
133+
"description": "Represents a SIP trunk patch.",
134+
"type": "object",
135+
"properties": {
136+
"sipSignalingPort": {
137+
"format": "int32",
138+
"description": "Gets or sets SIP signaling port of the trunk.",
139+
"type": "integer"
140+
}
141+
}
142+
},
143+
"TrunkRoute": {
144+
"description": "Represents a trunk route for routing calls.",
145+
"required": [
146+
"name",
147+
"numberPattern"
148+
],
149+
"type": "object",
150+
"properties": {
151+
"description": {
152+
"description": "Gets or sets description of the route.",
153+
"maxLength": 1024,
154+
"type": "string"
155+
},
156+
"name": {
157+
"description": "Gets or sets name of the route.",
158+
"maxLength": 256,
159+
"type": "string"
160+
},
161+
"numberPattern": {
162+
"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}$\".",
163+
"maxLength": 1024,
164+
"type": "string"
165+
},
166+
"trunks": {
167+
"description": "Gets or sets list of SIP trunks for routing calls. Trunks are represented as FQDN.",
168+
"maxLength": 250,
169+
"type": "array",
170+
"items": {
171+
"type": "string"
172+
}
173+
}
174+
}
175+
},
176+
"SipConfiguration": {
177+
"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.",
178+
"type": "object",
179+
"properties": {
180+
"trunks": {
181+
"description": "SIP trunks for routing calls.\r\nMap key is trunk's FQDN (1-249 characters).",
182+
"maxLength": 250,
183+
"type": "object",
184+
"additionalProperties": {
185+
"$ref": "#/definitions/Trunk"
186+
}
187+
},
188+
"routes": {
189+
"description": "Trunk routes for routing calls.",
190+
"maxLength": 250,
191+
"type": "array",
192+
"items": {
193+
"$ref": "#/definitions/TrunkRoute"
194+
}
195+
}
196+
}
197+
},
198+
"SipConfigurationPatch": {
199+
"description": "Represents a SIP configuration patch.",
200+
"type": "object",
201+
"properties": {
202+
"trunks": {
203+
"description": "SIP trunks for routing calls.\r\nMap key is trunk's FQDN (1-249 characters).",
204+
"maxLength": 250,
205+
"type": "object",
206+
"additionalProperties": {
207+
"$ref": "#/definitions/TrunkPatch"
208+
}
209+
},
210+
"routes": {
211+
"description": "Trunk routes for routing calls.",
212+
"maxLength": 250,
213+
"type": "array",
214+
"items": {
215+
"$ref": "#/definitions/TrunkRoute"
216+
}
217+
}
218+
}
219+
}
220+
},
221+
"parameters": {
222+
"ApiVersionParameter": {
223+
"in": "query",
224+
"name": "api-version",
225+
"description": "Version of API to invoke",
226+
"required": true,
227+
"type": "string"
228+
},
229+
"Endpoint": {
230+
"in": "path",
231+
"name": "endpoint",
232+
"description": "The communication resource, for example https://resourcename.communication.azure.com",
233+
"required": true,
234+
"type": "string",
235+
"x-ms-skip-url-encoding": true,
236+
"x-ms-parameter-location": "client"
237+
}
238+
},
239+
"securityDefinitions": {
240+
"azure_auth": {
241+
"type": "oauth2",
242+
"flow": "implicit",
243+
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
244+
"scopes": {
245+
"user_impersonation": "impersonate your user account"
246+
},
247+
"description": "Azure Active Directory OAuth2 Flow"
248+
}
249+
},
250+
"x-ms-parameterized-host": {
251+
"hostTemplate": "{endpoint}",
252+
"useSchemePrefix": false,
253+
"parameters": [
254+
{
255+
"$ref": "#/parameters/Endpoint"
256+
}
257+
]
258+
}
259+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"parameters": {
3+
"api-version": "2021-05-01-preview",
4+
"endpoint": "https://resourcename.communication.azure.com/"
5+
},
6+
"responses": {
7+
"200": {
8+
"headers": {},
9+
"body": {
10+
"trunks": {
11+
"vendor.xyz.biz": {
12+
"sipSignalingPort": 5061
13+
},
14+
"vendor.abc.biz": {
15+
"sipSignalingPort": 5061
16+
}
17+
},
18+
"routes": [
19+
{
20+
"name": "LocalRoute",
21+
"numberPattern": "^\\+1[0-9]{10}$"
22+
},
23+
{
24+
"name": "VendorXYZ",
25+
"description": "External route XYZ",
26+
"numberPattern": "^\\+?\\d+$",
27+
"trunks": [
28+
"vendor.xyz.biz"
29+
]
30+
}
31+
]
32+
}
33+
}
34+
}
35+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"parameters": {
3+
"api-version": "2021-05-01-preview",
4+
"body": {
5+
"trunks": {
6+
"vendor.xyz.biz": {
7+
"sipSignalingPort": 5061
8+
}
9+
},
10+
"routes": [
11+
{
12+
"name": "VendorXYZ",
13+
"description": "External route XYZ",
14+
"numberPattern": "^\\+?\\d+$",
15+
"trunks": [
16+
"vendor.xyz.biz"
17+
]
18+
}
19+
]
20+
},
21+
"endpoint": "https://resourcename.communication.azure.com/"
22+
},
23+
"responses": {
24+
"200": {
25+
"headers": {},
26+
"body": {
27+
"trunks": {
28+
"vendor.xyz.biz": {
29+
"sipSignalingPort": 5061
30+
}
31+
},
32+
"routes": [
33+
{
34+
"name": "VendorXYZ",
35+
"description": "External route XYZ",
36+
"numberPattern": "^\\+?\\d+$",
37+
"trunks": [
38+
"vendor.xyz.biz"
39+
]
40+
}
41+
]
42+
}
43+
},
44+
"415": {
45+
"headers": {},
46+
"body": {
47+
"error": {
48+
"code": "UnsupportedMediaType",
49+
"message": "Unsupported Media Type."
50+
}
51+
}
52+
},
53+
"422": {
54+
"headers": {},
55+
"body": {
56+
"error": {
57+
"code": "UnprocessableEntity",
58+
"message": "One or more request inputs are not valid.",
59+
"innererror": {
60+
"code": "InvalidRegex",
61+
"message": "Unsupported regex format provided."
62+
}
63+
}
64+
}
65+
},
66+
"500": {
67+
"headers": {},
68+
"body": {
69+
"error": {
70+
"code": "InternalError",
71+
"message": "The server encountered an internal error."
72+
}
73+
}
74+
}
75+
}
76+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## C
2+
3+
These settings apply only when `--csharp` is specified on the command line.
4+
Please also specify `--csharp-sdks-folder=<path to "SDKs" directory of your azure-sdk-for-net clone>`.
5+
6+
```yaml $(csharp)
7+
csharp:
8+
azure-arm: true
9+
license-header: MICROSOFT_MIT_NO_VERSION
10+
payload-flattening-threshold: 1
11+
clear-output-folder: true
12+
client-side-validation: false
13+
namespace: Microsoft.CommunicationServices
14+
output-folder: $(csharp-sdks-folder)/communicationservices/management/Microsoft.CommunicationServices/GeneratedProtocol
15+
```

0 commit comments

Comments
 (0)