-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapiary.apib
126 lines (66 loc) · 10.5 KB
/
apiary.apib
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
FORMAT: 1A
HOST: http://your.host/
# vnf-asterisk-controller
VNF asterisk controller API allows you to interact with discovered Asterisk instances, and manage configurations via push configuration.
Generally speaking this API does not have auth (you must otherwise protect it using firewalls or other methods) for now as it is a PoC.
In general you access this using `GET` methods and tag parameters on paths to the API.
## Using this document
This document also provides a "mock api" -- if you view the details of a specific API endpoint you can change the dropdown to "mock server" and the application of your choice (I recommend cURL for a quick test) you can run a command against a mock server and see what the data looks like.
## Discover [/discover]
The discover endpoint allows you to list the Asterisk instances that have reported to etcd, and give you their unique ID (a UUID), an optional nickname, and the IP address on which they're listening for VoIP traffic, as well as a list of trunks configered on each instance.
### List All Discovered Asterisk instances [GET]
+ Response 200 (application/json)
[{"uuid":"a66faf87-46dd-416f-a746-2692a503d1c1","ip":"172.19.0.4","nickname":"asterisk1","trunks":["alice"]},{"uuid":"3bac1d88-aef2-494d-a1f7-8d7046aebfa9","ip":"172.19.0.5","nickname":"asterisk2","trunks":[]}]
## Connect two instances with trunks for each instance [/connect/{instance_a_uuid}/{instance_a_uuid}/{context}]
This allows you to push a SIP trunk configuration to two Asterisk instances, creating complimentary trunks for each one.
If you were connecting, instances called `toyko` and `new_york` -- On the `tokyo` instance, there would be a trunk to `new_york`, and... On the instance for `new_york` there would be an instance to `tokyo`.
### Connect two instances by creating SIP endpoints for each configuration to an Asterisk instance [GET]
Using the `uuid`s for each instance as found using the `/discover` API endpoint we connect two instances.
Parameters here are:
* `instance_a_uuid`: As found with `/discover` API endpoint
* `instance_b_uuid`: As found with `/discover` API endpoint
* `context`: The context used for handling inbound calls for the endpoint (must exist in the dialplan for both instances)
Returns a JSON object describing the details of both trunks.
+ Response 200 (application/json)
+ Body
{"create_trunk_a":{"name":"asterisk2","boxid":"835ff6af-48ff-4b7c-ba6f-f8b30732c0b9","box_address":"172.19.0.5","endpoint":{"context":"inbound","aors":"asterisk2","transport":"transport-udp","allow":"ulaw","disallow":"all"},"identify":{"match":"172.19.0.4/32"},"aor":{"contact_address":"sip:[email protected]:5060"}},"create_trunk_b":{"name":"asterisk1","boxid":"316c9c40-614f-49cb-b554-d0696a8f6f3d","box_address":"172.19.0.4","endpoint":{"context":"inbound","aors":"asterisk1","transport":"transport-udp","allow":"ulaw","disallow":"all"},"identify":{"match":"172.19.0.5/32"},"aor":{"contact_address":"sip:[email protected]:5060"}}}
## Push configuration [/pushconfig/{instance_uuid}/{username}/{ip_address}/{mask_bits}]
This allows you to push a specific configuration to an Asterisk instance.
### Push a new endpoint configuration to an Asterisk instance [GET]
Using the `uuid` as found using the `/discover` endpoint.
Parameters here are:
* `instance_uuid`: As found with `/discover` endpoint
* `username`: a nickname for the endpoint created
+ Response 200 (application/json)
+ Body
{"created_username":"alice","box_created":"9c220873-7e1f-4ae7-9aab-bc536e2bf974"}
## Get configuration [/getconfig/{instance_uuid}/{username}]
This allows you to list an existing specific configuration to an Asterisk instance.
### Get info about a specific endpoint configuration on an Asterisk instance [GET]
Parameters here are:
* `instance_uuid`: As found with `/discover` endpoint
* `username`: the nickname, as used previously with push, for the endpoint created
Returns a JSON object that has two fields:
* `exists`: true/false if the endpoint exists or not
* `data`: the raw response from Asterisk if the endpoint exists with info about the endpoint.
+ Response 200 (application/json)
+ Body
{"exists":true,"data":"[{\"attribute\":\"timers_sess_expires\",\"value\":\"1800\"},{\"attribute\":\"device_state_busy_at\",\"value\":\"0\"},{\"attribute\":\"dtls_cipher\",\"value\":\"\"},{\"attribute\":\"from_domain\",\"value\":\"\"},{\"attribute\":\"dtls_rekey\",\"value\":\"0\"},{\"attribute\":\"dtls_fingerprint\",\"value\":\"SHA-256\"},{\"attribute\":\"direct_media_method\",\"value\":\"invite\"},{\"attribute\":\"send_rpid\",\"value\":\"false\"},{\"attribute\":\"pickup_group\",\"value\":\"\"},{\"attribute\":\"sdp_session\",\"value\":\"Asterisk\"},{\"attribute\":\"dtls_verify\",\"value\":\"No\"},{\"attribute\":\"message_context\",\"value\":\"\"},{\"attribute\":\"mailboxes\",\"value\":\"\"},{\"attribute\":\"named_pickup_group\",\"value\":\"\"},{\"attribute\":\"record_on_feature\",\"value\":\"automixmon\"},{\"attribute\":\"dtls_private_key\",\"value\":\"\"},{\"attribute\":\"named_call_group\",\"value\":\"\"},{\"attribute\":\"t38_udptl_maxdatagram\",\"value\":\"0\"},{\"attribute\":\"media_encryption_optimistic\",\"value\":\"false\"},{\"attribute\":\"aors\",\"value\":\"\"},{\"attribute\":\"rpid_immediate\",\"value\":\"false\"},{\"attribute\":\"outbound_proxy\",\"value\":\"\"},{\"attribute\":\"identify_by\",\"value\":\"username\"},{\"attribute\":\"inband_progress\",\"value\":\"false\"},{\"attribute\":\"rtp_symmetric\",\"value\":\"false\"},{\"attribute\":\"transport\",\"value\":\"\"},{\"attribute\":\"rtp_keepalive\",\"value\":\"0\"},{\"attribute\":\"t38_udptl_ec\",\"value\":\"none\"},{\"attribute\":\"fax_detect\",\"value\":\"false\"},{\"attribute\":\"t38_udptl_nat\",\"value\":\"false\"},{\"attribute\":\"allow_transfer\",\"value\":\"true\"},{\"attribute\":\"tos_video\",\"value\":\"0\"},{\"attribute\":\"srtp_tag_32\",\"value\":\"false\"},{\"attribute\":\"timers_min_se\",\"value\":\"90\"},{\"attribute\":\"call_group\",\"value\":\"\"},{\"attribute\":\"sub_min_expiry\",\"value\":\"0\"},{\"attribute\":\"100rel\",\"value\":\"yes\"},{\"attribute\":\"direct_media\",\"value\":\"true\"},{\"attribute\":\"fax_detect_timeout\",\"value\":\"0\"},{\"attribute\":\"rtp_timeout_hold\",\"value\":\"0\"},{\"attribute\":\"g726_non_standard\",\"value\":\"false\"},{\"attribute\":\"dtmf_mode\",\"value\":\"rfc4733\"},{\"attribute\":\"voicemail_extension\",\"value\":\"\"},{\"attribute\":\"rtp_timeout\",\"value\":\"0\"},{\"attribute\":\"dtls_cert_file\",\"value\":\"\"},{\"attribute\":\"media_encryption\",\"value\":\"no\"},{\"attribute\":\"media_use_received_transport\",\"value\":\"false\"},{\"attribute\":\"direct_media_glare_mitigation\",\"value\":\"none\"},{\"attribute\":\"trust_id_inbound\",\"value\":\"false\"},{\"attribute\":\"force_avp\",\"value\":\"false\"},{\"attribute\":\"record_off_feature\",\"value\":\"automixmon\"},{\"attribute\":\"send_diversion\",\"value\":\"true\"},{\"attribute\":\"language\",\"value\":\"\"},{\"attribute\":\"mwi_from_user\",\"value\":\"\"},{\"attribute\":\"asymmetric_rtp_codec\",\"value\":\"false\"},{\"attribute\":\"rtp_ipv6\",\"value\":\"false\"},{\"attribute\":\"ice_support\",\"value\":\"false\"},{\"attribute\":\"callerid\",\"value\":\"<unknown>\"},{\"attribute\":\"aggregate_mwi\",\"value\":\"true\"},{\"attribute\":\"one_touch_recording\",\"value\":\"false\"},{\"attribute\":\"moh_passthrough\",\"value\":\"false\"},{\"attribute\":\"cos_video\",\"value\":\"0\"},{\"attribute\":\"accountcode\",\"value\":\"\"},{\"attribute\":\"allow\",\"value\":\"(nothing)\"},{\"attribute\":\"rewrite_contact\",\"value\":\"false\"},{\"attribute\":\"t38_udptl_ipv6\",\"value\":\"false\"},{\"attribute\":\"tone_zone\",\"value\":\"\"},{\"attribute\":\"user_eq_phone\",\"value\":\"false\"},{\"attribute\":\"allow_subscribe\",\"value\":\"true\"},{\"attribute\":\"rtp_engine\",\"value\":\"asterisk\"},{\"attribute\":\"subscribe_context\",\"value\":\"\"},{\"attribute\":\"auth\",\"value\":\"\"},{\"attribute\":\"from_user\",\"value\":\"\"},{\"attribute\":\"bind_rtp_to_media_address\",\"value\":\"false\"},{\"attribute\":\"disable_direct_media_on_nat\",\"value\":\"false\"},{\"attribute\":\"set_var\",\"value\":\"\"},{\"attribute\":\"contact_acl\",\"value\":\"\"},{\"attribute\":\"use_ptime\",\"value\":\"false\"},{\"attribute\":\"outbound_auth\",\"value\":\"\"},{\"attribute\":\"media_address\",\"value\":\"\"},{\"attribute\":\"tos_audio\",\"value\":\"0\"},{\"attribute\":\"dtls_ca_path\",\"value\":\"\"},{\"attribute\":\"dtls_setup\",\"value\":\"active\"},{\"attribute\":\"force_rport\",\"value\":\"true\"},{\"attribute\":\"connected_line_method\",\"value\":\"invite\"},{\"attribute\":\"callerid_tag\",\"value\":\"\"},{\"attribute\":\"timers\",\"value\":\"yes\"},{\"attribute\":\"sdp_owner\",\"value\":\"-\"},{\"attribute\":\"acl\",\"value\":\"\"},{\"attribute\":\"trust_id_outbound\",\"value\":\"false\"},{\"attribute\":\"use_avpf\",\"value\":\"false\"},{\"attribute\":\"context\",\"value\":\"default\"},{\"attribute\":\"moh_suggest\",\"value\":\"default\"},{\"attribute\":\"send_pai\",\"value\":\"false\"},{\"attribute\":\"t38_udptl\",\"value\":\"false\"},{\"attribute\":\"dtls_ca_file\",\"value\":\"\"},{\"attribute\":\"callerid_privacy\",\"value\":\"allowed_not_screened\"},{\"attribute\":\"mwi_subscribe_replaces_unsolicited\",\"value\":\"false\"},{\"attribute\":\"cos_audio\",\"value\":\"0\"}]"}
## Delete configuration [/deleteconfig/{instance_uuid}/{username}]
This allows you to delete a specific configuration as previously pushed to an Asterisk instance.
### Delete an existing endpoint configuration to an Asterisk instance [GET]
Parameters here are:
* `instance_uuid`: As found with `/discover` endpoint
* `username`: the nickname, as used previously with push, for the endpoint created
+ Response 200 (application/json)
+ Body
{"deleted_username":"alice","box_deleted":"9c220873-7e1f-4ae7-9aab-bc536e2bf974"}
## Get Trunk Information [/gettrunk/{instance_uuid}/{trunk_name}]
This allows you to get information about a trunk
### Retreive detailed trunk information [GET]
Parameters here are:
* `instance_uuid`: As found with `/discover` endpoint
* `trunk_name`: the trunkname, as used previously with push, and listed in the `/discover` endpoint.
+ Response 200 (application/json)
+ Body
{"name":"alice","boxid":"86faa28d-4cf4-4b3b-ae8b-08a20c4c2426","box_address":"172.19.0.3","endpoint":{"context":"inbound","aors":"alice","transport":"transport-udp","allow":"ulaw","disallow":"all"},"identify":{"match":"172.19.0.5/32"},"aor":{"contact_address":"sip:[email protected]:5060"}}