forked from camaraproject/CallForwardingSignal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCall_Forwarding_Signal.yaml
610 lines (610 loc) · 25 KB
/
Call_Forwarding_Signal.yaml
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
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
---
openapi: 3.0.3
############################################################################
# API info #
############################################################################
info:
title: Call Forwarding Signal
description: |
# Overview
The Call Forwarding Signal (CFS) API provides the API Consumer with
information about the status of the Call Forwading Service on a specific
phone number. The main scope of the CFS API is "anti Fraud" to avoid
fraudsters to use the Call Forwarding Service to carry on a scam. Other use
cases are anyway supported by the CFS API that also provides additional
endpoints to detect the general Call Forwarding Service settings.
# Introduction
The Call Forwarding Service is provided by the Network to a phone
number. This service redirects the incoming call to that phone number
to an alternative destination such as another phone number or a voice mail
system. There are two main types of call forwarding settings:
unconditional and conditional.
The CFS API can be invoked to detect if the unconditional
call forwarding service is active. The CSF API can also be invoked to
get the general status of the Call Forwarding Service (inactive,
conditional, unconditional). If conditional call forwarding is active,
the differente type of settings are returned ('conditional_busy',
'conditional_unavailable', 'conditional_no_reply').\
\
**Example use cases:**\
\
[**Bank Frauds**](https://github.com/camaraproject/CallForwardingSignal\
/discussions/3#discussioncomment-8694420)\
\
[**Alert Interception**](https://github.com/camaraproject/CallForwarding\
Signal/discussions/3#discussioncomment-8701847)\
\
[**Call Forwading Verification**](https://github.com/camaraproject/\
CallForwarding\Signal/discussions/3#discussioncomment-8915595)
# Quick Start
The CFS API is a REST API based on the CreateCallForwardingSignal resource.
This resource can be filled during the API invokation, by the API Consumer,
with the phone number on which the Call Forwarding Service status must be
verified. Anyway the phone number is also detected, by the API Producer,
from the access token.\
\
Before starting to use the Call Forwarding API, the developer needs to know
about the below specified details:\
\
**phoneNumber**
This is the end user phone number. The CFS API verifies if a call forwarding
service is active on this phone number. Note: the value of this optional
parameter must match the value of the phone number retrieved from the access
token.\
\
**CreateCallForwardingSignal**
This is the resource the API Consumer uses to define the phone number to
be verified about the status of the Network Call Forwarding service.\
\
**UnconditionalCallForwardingSignal**
This is the resource the API Consumer gets back, containing the information
about the Unconditional Call Forwarding Service status for the given phone
number (PhoneNumber)\
\
**CallForwardingSignal**
This is the resource the API Consumer gets back, containing the information
about the general status of the Network Call Forwarding service for the
specified phone number.\
\
The CFS API provides two endpoints fulfilling the following intents:
- **unconditional-call-forwardings**: Is the unconditional call fwd service
active on a specific phone number?
- **call-forwardings**: Which is the status of the call forwarding for a
specific phone number?
# Authorization and authentication
CAMARA guidelines defines a set of authorization flows which can grant API
clients access to the API functionality, as outlined in the document
[CAMARA-API-access-and-user-consent.md](https:\
//github.com/camaraproject/IdentityAndConsentManagement/blob/main/\
documentation/CAMARA-API-access-and-user-consent.md).
Which specific authorization flows are to be used will be determined during
onboarding process, happening between the API Client and the
Telco Operator exposing the API, taking into account the declared purpose
for accessing the API, while also being subject to the prevailing legal
framework dictated by local legislation.\
Specifically, for the CFS API, the CIBA flow should be adopted. The CIBA
flow is described here:[CIBA Flow](https://github.com/camaraproject/\
IdentityAndConsentManagement/blob/main/documentation/\
CAMARA-Security-Interoperability.md\
#client-initiated-backchannel-authentication-flow). The "login_hint" must be
the user's phone number valorised as the parameter PhoneNumber, if used. If
a mismatch is detected, a 403 error is returned (`INVALID_TOKEN_CONTEXT`).
\
It is important to remark that in cases where personal user data is
processed by the API, and users can exercise their rights through mechanisms
such as opt-in and/or opt-out, the use of 3-legged access tokens becomes
mandatory.
This measure ensures that the API remains in strict compliance with user
privacy preferences and regulatory obligations,
upholding the principles of transparency and user-centric data control.
# Identifying the phone number from the access token
This specification defines the "phoneNumber" field as optional in API
requests because using a 3-legged access token the phone number can be
uniquely identified by the token.
## Handling of phone number information:
### Optional phone number object for 3-legged tokens:
When using a 3-legged access token, the phone number associated with the
access token must be considered as the phone number for the API request.
This means that the "phoneNumber" paramenter is not required in the request,
and if it is included it must identify the same phone number.
### Validation mechanism:
- The server will extract the phone number identification from the access
token, if available.
- If the API request additionally includes a "phoneNumber" parameter when
using a 3-legged access token, the API will validate that the phone number
identifier provided matches the one associated with the access token.
- If there is a mismatch, the API will respond with a
403 `INVALID_TOKEN_CONTEXT` error, indicating that the device information
in the request does not match the token.
### Error handling for unidentifiable devices:
- If the "phoneNumber" parameter is not included in the request and the
phone number information cannot be derived from the 3-legged access token,
the server will return a 422 `UNIDENTIFIABLE_DEVICE` error.
# API Documentation
## Details
The CFS API is invoked by an API Consumer after the Consent Management
flow.\
The API Consumer can request the API Producer for the status of the
Unconditional Call Forwarding service using the
unconditional-call-forwardings POST method. A boolean, with the information
about the activation status of the call forwarding service, will be
provided back via the UnconditionalCallForwardingSignal resource.\
The API Consumer can also request the API Producer for the generic status of
the Call Forwarding service using the call-forwardings POST method. An array
of strings with the information of the type of active call forwarding
services will be provided back via the CallForwardingSignal resource.\
CFS API have to check the Call Forwarding
Service status can be optionally defined with resource
(CreateCallForwardingSignal) containing the phone number (PhoneNumber)
to be checked.
# FAQ's
(FAQs will be added in a later version of the documentation)
# Release Notes
First draft for the CFS API.
# API version - Aligned to SemVer 2.0 according to CAMARA versioning guidelines
version: 0.2.0-rc.1
# Name of the license and a URL to the license description
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
# CAMARA Commonalities version - x.y.z
x-camara-commonalities: 0.4.0
contact:
email: [email protected]
externalDocs:
description: Product documentation at Camara
url: https://github.com/camaraproject/CallForwardingSignal
############################################################################
# Servers #
############################################################################
servers:
- url: "{apiRoot}/call-forwarding-signal/v0.2rc1"
variables:
apiRoot:
default: http://localhost:9091
description: API root for the Call Forwarding Signal API
############################################################################
# Tags #
############################################################################
tags:
- name: Unconditional Call Forwarding information retrieval
description: Provides information on Unconditional Call Forwarding
settings for the provided phone number (PhoneNumber)
- name: Call Forwarding information retrieval
description: Provides information on Call Forwarding settings for the
provided phone number (PhoneNumber).
############################################################################
# Paths #
############################################################################
paths:
/unconditional-call-forwardings:
post:
tags:
- Unconditional Call Forwarding information retrieval
security:
- openId:
- 'call-forwarding-signal:unconditional-call-forwardings:read'
summary: Retrieve the information about the status of the
unconditional call forwarding service on a phone number (PhoneNumber)
description: This endpoint provides information about the status
of the unconditional call forwarding, beeing active or not.
operationId: retrieveUnconditionalCallForwarding
parameters:
- $ref: '#/components/parameters/x-correlator'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateCallForwardingSignal'
required: true
responses:
'200':
description: OK.
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/UnconditionalCallForwardingSignal'
"400":
$ref: "#/components/responses/Generic400"
'404':
$ref: '#/components/responses/Generic404'
'500':
$ref: '#/components/responses/Generic500'
'504':
$ref: '#/components/responses/Generic504'
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"409":
$ref: "#/components/responses/Generic409"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"503":
$ref: "#/components/responses/Generic503"
/call-forwardings:
post:
tags:
- Call Forwarding information retrieval
security:
- openId:
- 'call-forwarding-signal:call-forwardings:read'
summary: Retrieve the information about the type of call forwarding
service active on a phone number (PhoneNumber)
description: This endpoint provides information about wich type of
call forwarding service is active. More than one service can be
active, e.g. conditional and unconditional. This endpoit exceeds
the main scope of the CFS API, for this reason an error code 501
can be returned.
operationId: retrieveCallForwarding
parameters:
- $ref: '#/components/parameters/x-correlator'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateCallForwardingSignal'
required: true
responses:
'200':
description: OK.
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/CallForwardingSignal'
"400":
$ref: "#/components/responses/Generic400"
'404':
$ref: '#/components/responses/Generic404'
'500':
$ref: '#/components/responses/Generic500'
'504':
$ref: '#/components/responses/Generic504'
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"409":
$ref: "#/components/responses/Generic409"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"501":
$ref: "#/components/responses/Generic501"
"503":
$ref: "#/components/responses/Generic503"
############################################################################
# Components #
############################################################################
components:
securitySchemes:
openId:
description: to support Consent Management
type: openIdConnect
openIdConnectUrl: https://example.com/.well-known/openid-configuration
parameters:
x-correlator:
name: x-correlator
in: header
description: Correlation id for the different services
schema:
type: string
headers:
x-correlator:
description: Correlation id for the different services
schema:
type: string
############################################################################
# Resources #
############################################################################
schemas:
UnconditionalCallForwardingSignal:
description: resource containing the information about the Unconditional
Call Forwarding Service for the given phone number (PhoneNumber)
type: object
properties:
active:
type: boolean
description: Indicates if the unconditional call forwarding service
is active.
CallForwardingSignal:
description: resource containing the list of the Call
Forwarding Services active for the given phone number (PhoneNumber). The
possible states are, 'inactive' (no call forwarding service activated),
'unconditional' (call forwarded independently from the device status),
'conditional_busy' (call forwarded if the device is on an active call),
'conditional_unavailable' (call forwarded if the device is not available
on the network), 'conditional_no_reply' (call forwarded if the device
doesn't answer the incoming call).
type: array
items:
type: string
enum:
- 'inactive'
- 'unconditional'
- 'conditional_busy'
- 'conditional_unavailable'
- 'conditional_no_reply'
example:
- 'unconditional'
- 'conditional_busy'
- 'conditional_no_reply'
minItems: 1
############################################################################
# Request #
############################################################################
CreateCallForwardingSignal:
description: resource containing the phone number (PhoneNumber) regarding
which the Call Forwarding Service must be checked
type: object
properties:
phoneNumber:
$ref: "#/components/schemas/PhoneNumber"
############################################################################
# Types #
############################################################################
PhoneNumber:
description: A public identifier addressing a telephone subscription.
In mobile networks it corresponds to the MSISDN (Mobile Station
International Subscriber Directory Number). In order to be globally
unique it has to be formatted in international format, according to E.164
standard, prefixed with '+'.
type: string
pattern: '^\+[1-9][0-9]{4,14}$'
example: "+123456789"
############################################################################
# Responces #
############################################################################
ErrorInfo:
description: error information
type: object
required:
- status
- code
- message
properties:
status:
type: integer
description: HTTP status code returned along with this error response
code:
type: string
description: Code given to this error
message:
type: string
description: Detailed error description
responses:
Generic400:
description: Problem with the client request
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
example:
status: 400
code: INVALID_ARGUMENT
message: Client specified an invalid argument, request body or query
param
Generic401:
description: Authentication problem with the client request
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
example:
status: 401
code: UNAUTHENTICATED
message: Request not authenticated due to missing, invalid, or
expired credentials
Generic403:
description: Client does not have sufficient permission
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
examples:
PermissionDenied:
value:
status: 403
code: PERMISSION_DENIED
message: Client does not have sufficient permissions to perform
this action
InvalidTokenContext:
value:
status: 403
code: INVALID_TOKEN_CONTEXT
message: PhoneNumber parameter doesn't match the value from the
access token context
Generic404:
description: The specified resource was not found
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
example:
status: 404
code: CALL_FORWARDING.UNKNOWN_PHONE_NUMBER
message: Call forwarding check can't be done because the phone
number is unknown
Generic409:
description: Conflict
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_409_ABORTED:
description: Concurrency of processes of the same nature/scope
value:
status: 409
code: ABORTED
message: Concurrency conflict.
GENERIC_409_ALREADY_EXISTS:
description: Trying to create an existing resource
value:
status: 409
code: ALREADY_EXISTS
message: The resource that a client tried to create already
exists.
GENERIC_409_CONFLICT:
description: Duplication of an existing resource
value:
status: 409
code: CONFLICT
message: A specified resource duplicate entry found.
Generic415:
description: Unsupported Media Type
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_415_UNSUPPORTED_MEDIA_TYPE:
description: Payload format of the request is in an unsupported
format by the Server.
value:
status: 415
code: UNSUPPORTED_MEDIA_TYPE
message: The server refuses to accept the request because the
payload format is in an unsupported format.
Generic422:
description: Unprocessable Content
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_422_DEVICE_IDENTIFIERS_MISMATCH:
description: Inconsistency between device identifiers not pointing
to the same device
value:
status: 422
code: DEVICE_IDENTIFIERS_MISMATCH
message: Provided device identifiers are not consistent.
GENERIC_422_DEVICE_NOT_APPLICABLE:
description: Service is not available for the provided device
value:
status: 422
code: DEVICE_NOT_APPLICABLE
message: The service is not available for the provided device.
GENERIC_422_UNIDENTIFIABLE_DEVICE:
description: phone number not available neither from "phoneNumber"
or from the access token.
value:
status: 422
code: UNIDENTIFIABLE_DEVICE
message: phone number not defined
Generic429:
description: Too Many Requests
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_429_QUOTA_EXCEEDED:
description: Request is rejected due to exceeding a business quota
limit.
value:
status: 429
code: QUOTA_EXCEEDED
message: Either out of resource quota or reaching rate limiting.
GENERIC_429_TOO_MANY_REQUESTS:
description: API Server request limit is overpassed
value:
status: 429
code: TOO_MANY_REQUESTS
message: Either out of resource quota or reaching rate limiting.
Generic500:
description: Server error
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
example:
status: 500
code: INTERNAL
message: Server error
Generic501:
description: Not Implemented
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_501_NOT_IMPLEMENTED:
description: Service not implemented. The use of this code should
be avoided as far as possible to get the objective to reach
aligned implementations
value:
status: 501
code: NOT_IMPLEMENTED
message: This functionality is not implemented yet.
Generic503:
description: Service unavailable. Typically the server is down
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
example:
status: 503
code: UNAVAILABLE
message: Service unavailable
Generic504:
description: Request time exceeded. If it happens repeatedly, consider
reducing the request complexity
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
example:
status: 504
code: TIMEOUT
message: Request timeout exceeded. Try later