]> git.defcon.no Git - hermes/blob - api-nodes.txt
Added sql_dbexec_rows, allows testing of affected rows
[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 Tests if the given E164 number is in the pool.
111 Returns 'response' = 'ok' with 'number' = '<number>' If the number is in the pool
112 Returns response = 'failed' with 'cause' = 'nonexistant' if not.
113
114 alias/list
115 alias/list?destination=foo@bar.bz
116 alias/list?destination=foo@bar.bz&e164=true
117 alias/list?alias=foo@bar.bz
118 Currently not implemented
119
120 alias/add?alias_username=foo&alias_domain=bar.bz&destination=bar@qux.zx
121 Add an alias specified by alias_username and alias_domain that
122 points to the destination SIP-adress.
123
124 On success, 'ok' is returned, with 'alias' and 'destination' set
125 to the resulting alias and destination adresses.
126
127 Returns 'invalid' with 'cause' = 'destination' or 'alias' if the
128 resulting alias-adress or destination are invalid SIP-adresses.
129 Returns 'failed' with 'cause' = 'nxdomain' if the given alias domain
130 is not a Kamailio domain.
131 Returns 'failed' with 'cause' = 'exists' if the alias is an E164 number
132 and the user already has an E164 alias registered.
133 Returns 'failed' with 'cause' = 'nonexistant' when an alias for a local
134 domain is requested, but the local subscriber does not exist.
135 Returns 'failed' with 'cause' = 'exists' for aliases that already exists,
136 (and aliases that overlaps SIP-accounts - not implemented).
137
138
139 alias/remove?alias_username=foo&alias_domain=bar.bz
140 Removes the alias given by alias_username and alias_domain.
141
142 Returns 'ok' with the removed alias adress as 'alias' on success
143 Returns 'failed' with 'cause' = 'nonexistant' it the alias does not exists.
144 Returns 'invalid' with 'cause' = 'address' if the given alias is not a valid SIP adress.
145
146 TODO list:
147 ---------------------
148 Planned, but not implemented nodes/functions:
149 user/change_pw?username=foo&domain=bar&password=baz
150 user/update?username=foo&domain=bar
151 alias/list
152 alias/user?destination=foo@bar.bz
153
154 authentication-mechanism :)
155
156 Add collision prevention for users, make sure that no user can be added when the user
157 address would overlap/collide with a valid alias-address
158