-
Notifications
You must be signed in to change notification settings - Fork 74
/
events_gen.go
481 lines (434 loc) · 18.6 KB
/
events_gen.go
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
// file generated by eventgen
package ari
// EventTypes enumerates the list of event types
type EventTypes struct {
All string
ApplicationReplaced string
BridgeAttendedTransfer string
BridgeBlindTransfer string
BridgeCreated string
BridgeDestroyed string
BridgeMerged string
ChannelCallerID string
ChannelConnectedLine string
ChannelCreated string
ChannelDestroyed string
ChannelDialplan string
ChannelDtmfReceived string
ChannelEnteredBridge string
ChannelHangupRequest string
ChannelHold string
ChannelLeftBridge string
ChannelStateChange string
ChannelTalkingFinished string
ChannelTalkingStarted string
ChannelUnhold string
ChannelUserevent string
ChannelVarset string
ContactInfo string
ContactStatusChange string
DeviceStateChanged string
Dial string
EndpointStateChange string
MissingParams string
Peer string
PeerStatusChange string
PlaybackContinuing string
PlaybackFinished string
PlaybackStarted string
RecordingFailed string
RecordingFinished string
RecordingStarted string
StasisEnd string
StasisStart string
TextMessageReceived string
}
// Events is the instance for grabbing event types
var Events EventTypes
func init() {
Events.All = "all"
Events.ApplicationReplaced = "ApplicationReplaced"
Events.BridgeAttendedTransfer = "BridgeAttendedTransfer"
Events.BridgeBlindTransfer = "BridgeBlindTransfer"
Events.BridgeCreated = "BridgeCreated"
Events.BridgeDestroyed = "BridgeDestroyed"
Events.BridgeMerged = "BridgeMerged"
Events.ChannelCallerID = "ChannelCallerId"
Events.ChannelConnectedLine = "ChannelConnectedLine"
Events.ChannelCreated = "ChannelCreated"
Events.ChannelDestroyed = "ChannelDestroyed"
Events.ChannelDialplan = "ChannelDialplan"
Events.ChannelDtmfReceived = "ChannelDtmfReceived"
Events.ChannelEnteredBridge = "ChannelEnteredBridge"
Events.ChannelHangupRequest = "ChannelHangupRequest"
Events.ChannelHold = "ChannelHold"
Events.ChannelLeftBridge = "ChannelLeftBridge"
Events.ChannelStateChange = "ChannelStateChange"
Events.ChannelTalkingFinished = "ChannelTalkingFinished"
Events.ChannelTalkingStarted = "ChannelTalkingStarted"
Events.ChannelUnhold = "ChannelUnhold"
Events.ChannelUserevent = "ChannelUserevent"
Events.ChannelVarset = "ChannelVarset"
Events.ContactInfo = "ContactInfo"
Events.ContactStatusChange = "ContactStatusChange"
Events.DeviceStateChanged = "DeviceStateChanged"
Events.Dial = "Dial"
Events.EndpointStateChange = "EndpointStateChange"
Events.MissingParams = "MissingParams"
Events.Peer = "Peer"
Events.PeerStatusChange = "PeerStatusChange"
Events.PlaybackContinuing = "PlaybackContinuing"
Events.PlaybackFinished = "PlaybackFinished"
Events.PlaybackStarted = "PlaybackStarted"
Events.RecordingFailed = "RecordingFailed"
Events.RecordingFinished = "RecordingFinished"
Events.RecordingStarted = "RecordingStarted"
Events.StasisEnd = "StasisEnd"
Events.StasisStart = "StasisStart"
Events.TextMessageReceived = "TextMessageReceived"
}
// Parse parses the message into the specific eventer
func (ev *EventTypes) Parse(msg *Message) Event {
var e Event
switch msg.Type {
case ev.ApplicationReplaced:
e = &ApplicationReplaced{}
case ev.BridgeAttendedTransfer:
e = &BridgeAttendedTransfer{}
case ev.BridgeBlindTransfer:
e = &BridgeBlindTransfer{}
case ev.BridgeCreated:
e = &BridgeCreated{}
case ev.BridgeDestroyed:
e = &BridgeDestroyed{}
case ev.BridgeMerged:
e = &BridgeMerged{}
case ev.ChannelCallerID:
e = &ChannelCallerID{}
case ev.ChannelConnectedLine:
e = &ChannelConnectedLine{}
case ev.ChannelCreated:
e = &ChannelCreated{}
case ev.ChannelDestroyed:
e = &ChannelDestroyed{}
case ev.ChannelDialplan:
e = &ChannelDialplan{}
case ev.ChannelDtmfReceived:
e = &ChannelDtmfReceived{}
case ev.ChannelEnteredBridge:
e = &ChannelEnteredBridge{}
case ev.ChannelHangupRequest:
e = &ChannelHangupRequest{}
case ev.ChannelHold:
e = &ChannelHold{}
case ev.ChannelLeftBridge:
e = &ChannelLeftBridge{}
case ev.ChannelStateChange:
e = &ChannelStateChange{}
case ev.ChannelTalkingFinished:
e = &ChannelTalkingFinished{}
case ev.ChannelTalkingStarted:
e = &ChannelTalkingStarted{}
case ev.ChannelUnhold:
e = &ChannelUnhold{}
case ev.ChannelUserevent:
e = &ChannelUserevent{}
case ev.ChannelVarset:
e = &ChannelVarset{}
case ev.ContactInfo:
e = &ContactInfo{}
case ev.ContactStatusChange:
e = &ContactStatusChange{}
case ev.DeviceStateChanged:
e = &DeviceStateChanged{}
case ev.Dial:
e = &Dial{}
case ev.EndpointStateChange:
e = &EndpointStateChange{}
case ev.MissingParams:
e = &MissingParams{}
case ev.Peer:
e = &Peer{}
case ev.PeerStatusChange:
e = &PeerStatusChange{}
case ev.PlaybackContinuing:
e = &PlaybackContinuing{}
case ev.PlaybackFinished:
e = &PlaybackFinished{}
case ev.PlaybackStarted:
e = &PlaybackStarted{}
case ev.RecordingFailed:
e = &RecordingFailed{}
case ev.RecordingFinished:
e = &RecordingFinished{}
case ev.RecordingStarted:
e = &RecordingStarted{}
case ev.StasisEnd:
e = &StasisEnd{}
case ev.StasisStart:
e = &StasisStart{}
case ev.TextMessageReceived:
e = &TextMessageReceived{}
default:
e = &EventData{}
}
err := msg.DecodeAs(e)
if err != nil {
return e
}
return e
}
// ApplicationReplaced - "Notification that another WebSocket has taken over for an application.An application may only be subscribed to by a single WebSocket at a time. If multiple WebSockets attempt to subscribe to the same application, the newer WebSocket wins, and the older one receives this event."
type ApplicationReplaced struct {
EventData
}
// BridgeAttendedTransfer - "Notification that an attended transfer has occurred."
type BridgeAttendedTransfer struct {
EventData
DestinationApplication string `json:"destination_application"` // Application that has been transferred into
DestinationBridge string `json:"destination_bridge"` // Bridge that survived the merge result
DestinationLinkFirstLeg ChannelData `json:"destination_link_first_leg"` // First leg of a link transfer result
DestinationLinkSecondLeg ChannelData `json:"destination_link_second_leg"` // Second leg of a link transfer result
DestinationThreewayBridge BridgeData `json:"destination_threeway_bridge"` // Bridge that survived the threeway result
DestinationThreewayChannel ChannelData `json:"destination_threeway_channel"` // Transferer channel that survived the threeway result
DestinationType string `json:"destination_type"` // How the transfer was accomplished
IsExternal bool `json:"is_external"` // Whether the transfer was externally initiated or not
ReplaceChannel ChannelData `json:"replace_channel,omitempty"` // The channel that is replacing transferer_first_leg in the swap
Result string `json:"result"` // The result of the transfer attempt
TransferTarget ChannelData `json:"transfer_target,omitempty"` // The channel that is being transferred to
Transferee ChannelData `json:"transferee,omitempty"` // The channel that is being transferred
TransfererFirstLeg ChannelData `json:"transferer_first_leg"` // First leg of the transferer
TransfererFirstLegBridge BridgeData `json:"transferer_first_leg_bridge"` // Bridge the transferer first leg is in
TransfererSecondLeg ChannelData `json:"transferer_second_leg"` // Second leg of the transferer
TransfererSecondLegBridge BridgeData `json:"transferer_second_leg_bridge"` // Bridge the transferer second leg is in
}
// BridgeBlindTransfer - "Notification that a blind transfer has occurred."
type BridgeBlindTransfer struct {
EventData
Bridge BridgeData `json:"bridge"` // The bridge being transferred
Channel ChannelData `json:"channel"` // The channel performing the blind transfer
Context string `json:"context"` // The context transferred to
Exten string `json:"exten"` // The extension transferred to
IsExternal bool `json:"is_external"` // Whether the transfer was externally initiated or not
ReplaceChannel ChannelData `json:"replace_channel,omitempty"` // The channel that is replacing transferer when the transferee(s) can not be transferred directly
Result string `json:"result"` // The result of the transfer attempt
Transferee ChannelData `json:"transferee,omitempty"` // The channel that is being transferred
}
// BridgeCreated - "Notification that a bridge has been created."
type BridgeCreated struct {
EventData
Bridge BridgeData `json:"bridge"`
}
// BridgeDestroyed - "Notification that a bridge has been destroyed."
type BridgeDestroyed struct {
EventData
Bridge BridgeData `json:"bridge"`
}
// BridgeMerged - "Notification that one bridge has merged into another."
type BridgeMerged struct {
EventData
Bridge BridgeData `json:"bridge"`
BridgeFrom BridgeData `json:"bridge_from"`
}
// ChannelCallerID - "Channel changed Caller ID."
type ChannelCallerID struct {
EventData
CallerPresentation int `json:"caller_presentation"` // The integer representation of the Caller Presentation value.
CallerPresentationTxt string `json:"caller_presentation_txt"` // The text representation of the Caller Presentation value.
Channel ChannelData `json:"channel"` // The channel that changed Caller ID.
}
// ChannelConnectedLine - "Channel changed Connected Line."
type ChannelConnectedLine struct {
EventData
Channel ChannelData `json:"channel"` // The channel whose connected line has changed.
}
// ChannelCreated - "Notification that a channel has been created."
type ChannelCreated struct {
EventData
Channel ChannelData `json:"channel"`
}
// ChannelDestroyed - "Notification that a channel has been destroyed."
type ChannelDestroyed struct {
EventData
Cause int `json:"cause"` // Integer representation of the cause of the hangup
CauseTxt string `json:"cause_txt"` // Text representation of the cause of the hangup
Channel ChannelData `json:"channel"`
}
// ChannelDialplan - "Channel changed location in the dialplan."
type ChannelDialplan struct {
EventData
Channel ChannelData `json:"channel"` // The channel that changed dialplan location.
DialplanApp string `json:"dialplan_app"` // The application about to be executed.
DialplanAppData string `json:"dialplan_app_data"` // The data to be passed to the application.
}
// ChannelDtmfReceived - "DTMF received on a channel.This event is sent when the DTMF ends. There is no notification about the start of DTMF"
type ChannelDtmfReceived struct {
EventData
Channel ChannelData `json:"channel"` // The channel on which DTMF was received
Digit string `json:"digit"` // DTMF digit received (0-9, A-E, # or *)
DurationMs int `json:"duration_ms"` // Number of milliseconds DTMF was received
}
// ChannelEnteredBridge - "Notification that a channel has entered a bridge."
type ChannelEnteredBridge struct {
EventData
Bridge BridgeData `json:"bridge"`
Channel ChannelData `json:"channel"`
}
// ChannelHangupRequest - "A hangup was requested on the channel."
type ChannelHangupRequest struct {
EventData
Cause int `json:"cause"` // Integer representation of the cause of the hangup.
Channel ChannelData `json:"channel"` // The channel on which the hangup was requested.
Soft bool `json:"soft"` // Whether the hangup request was a soft hangup request.
}
// ChannelHold - "A channel initiated a media hold."
type ChannelHold struct {
EventData
Channel ChannelData `json:"channel"` // The channel that initiated the hold event.
Musicclass string `json:"musicclass,omitempty"` // The music on hold class that the initiator requested.
}
// ChannelLeftBridge - "Notification that a channel has left a bridge."
type ChannelLeftBridge struct {
EventData
Bridge BridgeData `json:"bridge"`
Channel ChannelData `json:"channel"`
}
// ChannelStateChange - "Notification of a channel's state change."
type ChannelStateChange struct {
EventData
Channel ChannelData `json:"channel"`
}
// ChannelTalkingFinished - "Talking is no longer detected on the channel."
type ChannelTalkingFinished struct {
EventData
Channel ChannelData `json:"channel"` // The channel on which talking completed.
Duration int `json:"duration"` // The length of time, in milliseconds, that talking was detected on the channel
}
// ChannelTalkingStarted - "Talking was detected on the channel."
type ChannelTalkingStarted struct {
EventData
Channel ChannelData `json:"channel"` // The channel on which talking started.
}
// ChannelUnhold - "A channel initiated a media unhold."
type ChannelUnhold struct {
EventData
Channel ChannelData `json:"channel"` // The channel that initiated the unhold event.
}
// ChannelUserevent - "User-generated event with additional user-defined fields in the object."
type ChannelUserevent struct {
EventData
Bridge BridgeData `json:"bridge,omitempty"` // A bridge that is signaled with the user event.
Channel ChannelData `json:"channel,omitempty"` // A channel that is signaled with the user event.
Endpoint EndpointData `json:"endpoint,omitempty"` // A endpoint that is signaled with the user event.
Eventname string `json:"eventname"` // The name of the user event.
Userevent interface{} `json:"userevent"` // Custom Userevent data
}
// ChannelVarset - "Channel variable changed."
type ChannelVarset struct {
EventData
Channel ChannelData `json:"channel,omitempty"` // The channel on which the variable was set.If missing, the variable is a global variable.
Value string `json:"value"` // The new value of the variable.
Variable string `json:"variable"` // The variable that changed.
}
// ContactInfo - "Detailed information about a contact on an endpoint."
type ContactInfo struct {
EventData
Aor string `json:"aor"` // The Address of Record this contact belongs to.
ContactStatus string `json:"contact_status"` // The current status of the contact.
RoundtripUsec string `json:"roundtrip_usec,omitempty"` // Current round trip time, in microseconds, for the contact.
Uri string `json:"uri"` // The location of the contact.
}
// ContactStatusChange - "The state of a contact on an endpoint has changed."
type ContactStatusChange struct {
EventData
ContactInfo ContactInfo `json:"contact_info"`
Endpoint EndpointData `json:"endpoint"`
}
// DeviceStateChanged - "Notification that a device state has changed."
type DeviceStateChanged struct {
EventData
DeviceState DeviceStateData `json:"device_state"` // Device state object
}
// Dial - "Dialing state has changed."
type Dial struct {
EventData
Caller ChannelData `json:"caller,omitempty"` // The calling channel.
Dialstatus string `json:"dialstatus"` // Current status of the dialing attempt to the peer.
Dialstring string `json:"dialstring,omitempty"` // The dial string for calling the peer channel.
Forward string `json:"forward,omitempty"` // Forwarding target requested by the original dialed channel.
Forwarded ChannelData `json:"forwarded,omitempty"` // Channel that the caller has been forwarded to.
Peer ChannelData `json:"peer"` // The dialed channel.
}
// EndpointStateChange - "Endpoint state changed."
type EndpointStateChange struct {
EventData
Endpoint EndpointData `json:"endpoint"`
}
// MissingParams - "Error event sent when required params are missing."
type MissingParams struct {
EventData
Params []string `json:"params"` // A list of the missing parameters
}
// Peer - "Detailed information about a remote peer that communicates with Asterisk."
type Peer struct {
EventData
Address string `json:"address,omitempty"` // The IP address of the peer.
Cause string `json:"cause,omitempty"` // An optional reason associated with the change in peer_status.
PeerStatus string `json:"peer_status"` // The current state of the peer. Note that the values of the status are dependent on the underlying peer technology.
Port string `json:"port,omitempty"` // The port of the peer.
Time string `json:"time,omitempty"` // The last known time the peer was contacted.
}
// PeerStatusChange - "The state of a peer associated with an endpoint has changed."
type PeerStatusChange struct {
EventData
Endpoint EndpointData `json:"endpoint"`
Peer Peer `json:"peer"`
}
// PlaybackContinuing - "Event showing the continuation of a media playback operation from one media URI to the next in the list."
type PlaybackContinuing struct {
EventData
Playback PlaybackData `json:"playback"` // Playback control object
}
// PlaybackFinished - "Event showing the completion of a media playback operation."
type PlaybackFinished struct {
EventData
Playback PlaybackData `json:"playback"` // Playback control object
}
// PlaybackStarted - "Event showing the start of a media playback operation."
type PlaybackStarted struct {
EventData
Playback PlaybackData `json:"playback"` // Playback control object
}
// RecordingFailed - "Event showing failure of a recording operation."
type RecordingFailed struct {
EventData
Recording LiveRecordingData `json:"recording"` // Recording control object
}
// RecordingFinished - "Event showing the completion of a recording operation."
type RecordingFinished struct {
EventData
Recording LiveRecordingData `json:"recording"` // Recording control object
}
// RecordingStarted - "Event showing the start of a recording operation."
type RecordingStarted struct {
EventData
Recording LiveRecordingData `json:"recording"` // Recording control object
}
// StasisEnd - "Notification that a channel has left a Stasis application."
type StasisEnd struct {
EventData
Channel ChannelData `json:"channel"`
}
// StasisStart - "Notification that a channel has entered a Stasis application."
type StasisStart struct {
EventData
Args []string `json:"args"` // Arguments to the application
Channel ChannelData `json:"channel"`
ReplaceChannel ChannelData `json:"replace_channel,omitempty"`
}
// TextMessageReceived - "A text message was received from an endpoint."
type TextMessageReceived struct {
EventData
Endpoint EndpointData `json:"endpoint,omitempty"`
Message TextMessageData `json:"message"`
}