]> git.defcon.no Git - hermes/blob - api-nodes.txt
Several changes: Parameter-changes to several nodes, stubs added, verification of...
[hermes] / api-nodes.txt
1 All API nodes currently use GET requests for all parameters.
2 All API nodes return JSON data, and all results will contain
3 a 'response' element. The 'response' may be set to:
4 * 'ok' on success. Further contents depend on the node requested.
5 * 'invalid' on invalid requests. A 'cause' element should give a
6 keyword denoting what was invalid about the request...
7 * 'failed' on simple failure. A 'cause' element is supplied, with a
8 failure-keyword (e.g. 'nonexistant', 'inuse', 'dbfail').
9 A final 'detail' is commonly included, with a verbose desctiption.
10 * 'error' on critical failure. Regard this as a soft form of "500 server error"...
11
12 List of API nodes:
13 ---------------------
14
15 user/get?username=foo&domain=bar
16 Return User information, not including hardphone association.
17 Possible extension: allow user/get?address=foo@bar
18
19 user/list
20 user/list?search=foo@bar
21 Return a list of users in user@domain format.
22 If the search parameter is included, a globbing search is performed,
23 and only matches are listed.
24
25 user/add_local?username=foo&domain=bar&displayname=baz&email=qux@zef.tld
26 Adds a user account to both Kamailio and provisioning,
27 if the username@domain is nonexistant, and the domain is local (handled by Kamailio).
28 The password for the user is auto-generated.
29 Returns a full user object, the same form as user/get
30
31 user/add_remote?username=foo&domain=bar&password=S3cr3t&displayname=baz&registrar=sip.example.com
32 optionals: &r_port=5060&proxy=sipproxy.example.com&p_port=5060&authid=realfoo&dialplan=(.*)&linetext=lalala
33 Adds a provisioning user for a remote SIP account. This allows locally provisioned hardphones
34 to be associated with non-local SIP accounts.
35 Returns a full user object, the same form as user/get
36 Returns 'failed' with 'cause' = 'domain' if an attempt is made to add_remote for a local domain.
37
38 user/remove?username=foo&domain=bar
39 Removes user account from Kamailio, if present, and removes user from provisioning.
40 Will fail if user has associated hardphones, remove phones before removing user.
41 Returns 'ok' on success.
42
43 user/gen_pw
44 Test-node, generates a random password on the same form as that used
45 by user/add_local. May be used with the to-be-implemented change_pw node.
46
47 user/change_pw?username=foo&domain=bar&password=baz
48 Not implemented!
49
50 user/update?username=foo&domain=bar
51 optionals: &displayname=baz&dialplan=(.*)&linetext=lalala
52 Not implemented! Will only be implemented for Local users.
53 Remote users will have to be removed, and re-added.
54
55 phone/get?mac=f00ba2ba5c00
56 phone/get?user=foo@bar.baz
57 Returns a list of associated elements. If MAC address is given as parameter,
58 a list of associated user@domain addresses is retruned. If user@domain is
59 given as parameter, a list of associated mac addresses is returned.
60
61 phone/list?search=f00ba2
62 Returns the list of registered MAC addresses. If the (optional) search
63 parameter is included, the list is the result of a globbing search,
64 a subset matching on the MAC addresses.
65
66 phone/add?mac=f00ba2ba5c00&username=foo&domain=bar.bz
67 phone/add?mac=f00ba2ba5c00&user=foo@bar.bz
68 Adds a phone-to-user association to Provisioning. The user may
69 be provided as 'username' and 'domain' in separate parameters,
70 or as 'user' in sip-address form. The MAC address must be valid,
71 in plain-hex or colon-separated form, and the user must
72 match a valid user registration.
73 Returns the mac+user combinations on success.
74
75 phone/remove?mac=f00ba2ba5c00&username=foo&domain=bar.bz
76 phone/remove?mac=f00ba2ba5c00&user=foo@bar.bz
77 Deletes a phone-to-user association. Required parameters
78 and formats are identical to the phone/add node.
79 Returns 'ok' on success.
80
81
82 numbers/list
83 numbers/list?search=1234
84 numbers/list?random=true
85 optional: limit=n
86 Gives a list of entries in the phone number pool.
87 With no parameters, the entire (ordered) list of available numbers is returned.
88 With 'search', the result of a pre-post globbing search is returned
89 With 'random', a list of entries is returned unordered (random order)
90 For all nodes, 'limit' may be a numeric limit of desired results.
91
92 numbers/add_range?start=%2B471234&end=%2B47123456
93 The start and end must have identical lead-in, and start must be less than end.
94 Both numbers must be given in E164 format, remember to urlencode the plus (+ -> %2B)
95 The numeric component of both will be extracted, and all numbers in the range
96 will be iteratively added to the pool, including the ending number.
97 Returns 'ok' on success.
98
99 numbers/add?number=%2B4761123456
100 Adds the given number to the pool, after verifying that the number is in
101 valid E164 format, and that the number does not already exist in the pool.
102 Returns 'response' 'ok' and "Added <number>" in 'detail' on success.
103
104 numbers/remove?number=%2B4761123456
105 Removes/pulls a number from the pool.
106 The number must be a valid e164 number, and must be present in the pool.
107 Returns 'response' as 'ok' with 'number' set to the number that was pulled from the pool.
108
109 numbers/inpool?number=%2B4761123456
110 A debug-node, may disappear at any time ^_^
111 Tests if the given E164 number is in the pool.
112 Returns 'response' = 'ok' with 'number' = '<number>' If the number is in the pool
113 Returns response = 'failed' with 'cause' = 'nonexistant' if not.
114
115 alias/list
116 alias/list?destination=foo@bar.bz
117 alias/list?destination=foo@bar.bz&e164=true
118 alias/list?alias=foo@bar.bz
119 Currently not implemented
120
121 alias/add?alias_username=foo&alias_domain=bar.bz&destination=bar@qux.zx
122 Add an alias specified by alias_username and alias_domain that
123 points to the destination SIP-adress.
124
125 On success, 'ok' is returned, with 'alias' and 'destination' set
126 to the resulting alias and destination adresses.
127
128 Returns 'invalid' with 'cause' = 'destination' or 'alias' if the
129 resulting alias-adress or destination are invalid SIP-adresses.
130 Returns 'failed' with 'cause' = 'nxdomain' if the given alias domain
131 is not a Kamailio domain.
132 Returns 'failed' with 'cause' = 'exists' if the alias is an E164 number
133 and the user already has an E164 alias registered.
134 Returns 'failed' with 'cause' = 'nonexistant' when an alias for a local
135 domain is requested, but the local subscriber does not exist.
136 Returns 'failed' with 'cause' = 'exists' for aliases that already exists,
137 (and aliases that overlaps SIP-accounts - not implemented).
138
139
140 alias/remove?alias_username=foo&alias_domain=bar.bz
141 Removes the alias given by alias_username and alias_domain.
142
143 Returns 'ok' with the removed alias adress as 'alias' on success
144 Returns 'failed' with 'cause' = 'nonexistant' it the alias does not exists.
145 Returns 'invalid' with 'cause' = 'address' if the given alias is not a valid SIP adress.
146
147 TODO list:
148 ---------------------
149 Planned, but not implemented nodes/functions:
150 user/change_pw?username=foo&domain=bar&password=baz
151 user/update?username=foo&domain=bar
152 alias/list
153 alias/user?destination=foo@bar.bz
154
155 Add collision prevention for aliases, make sure that no alias can be added when the alias
156 address would overlap/collide with a valid user-address
157
158 authentication-mechanism :)