Version 28.1 by michaely on 2015/07/14 10:04

Show last authors
1 {{layout}}
2 {{layout-section ac:type="two_right_sidebar"}}
3 {{layout-cell}}
4 {{info}}
5 The information on this page applies to **iSymphony 3.2+**.
6 {{/info}}
7
8 = (% style="color: rgb(0,0,0);" %)Description(%%) =
9
10 The websocket API provides realtime events about the current state of the iSymphony server. External applications can utilize this API to integrate with the iSymphony server, by reacting to events pertaining to users, and call state. In conjunction with the CRM widget, this API can also be utilized to create custom widgets for the iSymphony client interface.
11 {{/layout-cell}}
12
13 {{layout-cell}}
14 {{panel title="On this page:"}}
15
16
17 {{toc maxLevel="2" indent="1"/}}
18 {{/panel}}
19 {{/layout-cell}}
20 {{/layout-section}}
21
22 {{layout-section ac:type="single"}}
23 {{layout-cell}}
24
25
26 = Connecting To The Websocket =
27
28 The following URL can be used to connect to the websocket event API:
29
30 {{code}}
31 ws://manager:manag3rpa55word@<hostname or ip of the iSymphony server>:58080/communication_manager/ws/event
32 {{/code}}
33
34 = Security =
35
36 By default the Event API websocket will be restricted via HTTP Realm Auth and ACLs. The default credentials will be set to manager:manag3rpa55word, and the ACLs will be set up to only allow connections from localhost. You can also secure the connection further with SSL encryption. See Security for more information.
37
38 {{info}}
39 When securing the rest API with SSL, the URL used to connect to the Event API websocket must use wss and port 55050, instead of ws and port 58080.
40 {{/info}}
41
42 = JSON =
43
44 All messages sent to or from the Event API websocket must be in JSON format. Each event will contain a set of properties providing details of the event. Each event documentation page will specify the JSON representation, and properties, of the event. Properties in the event JSON representation will be in alphabetical order.
45
46 == Base Event Properties ==
47
48 Every event will contain the following two properties:
49
50 * **type** : Describes the type of event.
51 * **time** : Specifies the date/time the event was generated. Represented as a unix timestamp, in milliseconds.
52
53 = Object IDs =
54
55 Most events generated by the event API will contain UUIDs that can be used to identify objects the event relates to. Some events will reference multiple ids. These UUIDs are the same ids that are used to reference resources in the Live REST API, allowing collaboration between the Live REST API and the Event API.
56
57 {{note}}
58 The UUIDs do not persist across restarts of the iSymphony server. If the server is restarted, the objects will contain new UUIDs. Also, if an object is destroyed then re-added, even with the same configuration, the UUID that represents that object will be different from the original.
59 {{/note}}
60
61 = (% style="color: rgb(0,0,0);" %)Event Filtering(%%) =
62
63 The Event API allows connections to specify which events they want to receive from the websocket, by specifying property filters.
64
65 {{info}}
66 **Filters specify which events to filter in**, not filter out.
67 {{/info}}
68
69 == The Filter Message ==
70
71 A message, with the following format, can be sent to the websocket, in order to set the current filters for the connection.
72
73 {{code language="js"}}
74 {
75 "type" : "filter",
76 "filters" : [
77 {"property" : "<property name>" : "value" : "<filter value>"},
78 {"property" : "<property name>" : "value" : "<filter value>"},
79 ...
80 ]
81 }
82 {{/code}}
83
84 Where <property name> is the name of the property to filter, and <filter value> is the property value to filter on. Multiple property filters can be specified.
85
86
87
88 {{info}}
89 If an event does not contain a property specified in one of the filters, the event will not be received.
90 {{/info}}
91
92 == Filter Message Response ==
93
94 When a filter message is sent, the websocket will respond with one of the following messages:
95
96 === Success Message ===
97
98 Returned when the filter was properly applied.
99
100 {{code language="js"}}
101 {
102 "correlationId": null,
103 "time": 1436889163971,
104 "type": "success"
105 }
106 {{/code}}
107
108 === Error Message ===
109
110 Returned when an error occurred while processing the filter message.
111
112 {{code language="js"}}
113 {
114 "correlationId": null,
115 "error": "<error message>",
116 "time": 1436889377766,
117 "type": "error"
118 }
119 {{/code}}
120
121 == Correlation ID ==
122
123 You can specify a correlation id in the filter message, in order to tie the filter message to the generated response message. The correlation id is optional.
124
125 {{code language="js"}}
126 {
127 "type" : "filter",
128 "correlationId" : "123456",
129 "filters" : [
130 {"property" : "type" : "value" : "dial"}
131 ]
132 }
133 {{/code}}
134
135 The filter message above will respond with the following message:
136
137 {{code}}
138 {
139 "correlationId": "123456",
140 "time": 1436889163971,
141 "type": "success"
142 }
143 {{/code}}
144
145 == (% style="color: rgb(0,0,0);" %)Wildcard(%%) ==
146
147 If you specify a value of **"*"** for a filter property value, the property filter will match on any value of the property.
148
149 == Examples ==
150
151 The following filter will only allow events of type dial:
152
153 {{code language="js"}}
154 {
155 "type" : "filter",
156 "filters" : [
157 {"property" : "type" : "value" : "dial"}
158 ]
159 }
160 {{/code}}
161
162 The following filter will only allow events of type login and logout:
163
164 {{code language="js"}}
165 {
166 "type" : "filter",
167 "filters" : [
168 {"property" : "type" : "value" : "login"},
169 {"property" : "type" : "value" : "logout"}
170 ]
171 }
172 {{/code}}
173
174 The following filter will only allow events of type login and logout, for user mikey.
175
176 {{code language="js"}}
177 {
178 "type" : "filter",
179 "filters" : [
180 {"property" : "type" : "value" : "login"},
181 {"property" : "type" : "value" : "logout"},
182 {"property" : "username" : "value" : "mikey"}
183 ]
184 }
185 {{/code}}
186
187 The following filter will only allow events that reference a user:
188
189 {{code language="js"}}
190 {
191 "type" : "filter",
192 "filters" : [
193 {"property" : "username" : "value" : "*"}
194 ]
195 }
196 {{/code}}
197
198 = REST Resources =
199
200 The Live API exposes several REST resources, that allow access to the current state of specific objects in the system. All current live resources are listed below. Details concerning each resource, and their actions, can be found within the individual resource documentation pages.
201
202 == Resource List ==
203
204
205
206 {{children/}}
207
208 == Notes on Resource Documentation ==
209
210 Due to the interdependent nature of resources in the system, the resource path information in the documentation is split into several sections. Paths in a specific section may relate to, or require, paths specified in other sections.
211
212 * **Root Resource Paths : **Specifies paths that can be used to access sets (multiple instances) of a resource, in relation to a parent resource.
213 * **Instance Resource Paths : **Specifies paths that can be used to access a specific instance of a resource. These paths require a **Root Resource Path**, in most cases, but not all.
214 * **Sub Resource Paths : **Specifies paths that provide access to the child resources, of a specific resource instance. These paths require an **Instance Resource Path.**
215 * **Action Paths: **Specifies paths that are used to perform actions on a specific resource instance. These paths require an **Instance Resource Path.**
216
217 \\
218 {{/layout-cell}}
219 {{/layout-section}}
220 {{/layout}}