Class: Zernio::CallRecord

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/call_record.rb

Overview

One call on a number you own, either channel. channel tells you which lane it took: whatsapp (WhatsApp Business Calling) or pstn (a regular phone call). List endpoints omit transcript; use lastTranscriptSnippet for a preview and the detail endpoint for the full transcript.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CallRecord

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
# File 'lib/zernio-sdk/models/call_record.rb', line 234

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CallRecord` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CallRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'_id')
    self._id = attributes[:'_id']
  end

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  end

  if attributes.key?(:'conversation_id')
    self.conversation_id = attributes[:'conversation_id']
  end

  if attributes.key?(:'contact_id')
    self.contact_id = attributes[:'contact_id']
  end

  if attributes.key?(:'channel')
    self.channel = attributes[:'channel']
  end

  if attributes.key?(:'direction')
    self.direction = attributes[:'direction']
  end

  if attributes.key?(:'from')
    self.from = attributes[:'from']
  end

  if attributes.key?(:'to')
    self.to = attributes[:'to']
  end

  if attributes.key?(:'forward_to')
    self.forward_to = attributes[:'forward_to']
  end

  if attributes.key?(:'greeting')
    self.greeting = attributes[:'greeting']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'is_voicemail')
    self.is_voicemail = attributes[:'is_voicemail']
  end

  if attributes.key?(:'amd')
    self.amd = attributes[:'amd']
  end

  if attributes.key?(:'answered_machine')
    self.answered_machine = attributes[:'answered_machine']
  end

  if attributes.key?(:'forward_caller_id')
    self.forward_caller_id = attributes[:'forward_caller_id']
  end

  if attributes.key?(:'recording_enabled')
    self.recording_enabled = attributes[:'recording_enabled']
  end

  if attributes.key?(:'transcription_enabled')
    self.transcription_enabled = attributes[:'transcription_enabled']
  end

  if attributes.key?(:'transcription_language')
    self.transcription_language = attributes[:'transcription_language']
  end

  if attributes.key?(:'started_at')
    self.started_at = attributes[:'started_at']
  end

  if attributes.key?(:'answered_at')
    self.answered_at = attributes[:'answered_at']
  end

  if attributes.key?(:'ended_at')
    self.ended_at = attributes[:'ended_at']
  end

  if attributes.key?(:'transferred_at')
    self.transferred_at = attributes[:'transferred_at']
  end

  if attributes.key?(:'duration_seconds')
    self.duration_seconds = attributes[:'duration_seconds']
  end

  if attributes.key?(:'end_reason')
    self.end_reason = attributes[:'end_reason']
  end

  if attributes.key?(:'hangup_cause')
    self.hangup_cause = attributes[:'hangup_cause']
  end

  if attributes.key?(:'sip_hangup_cause')
    self.sip_hangup_cause = attributes[:'sip_hangup_cause']
  end

  if attributes.key?(:'call_errors')
    if (value = attributes[:'call_errors']).is_a?(Array)
      self.call_errors = value
    end
  end

  if attributes.key?(:'recording_url')
    self.recording_url = attributes[:'recording_url']
  end

  if attributes.key?(:'last_transcript_snippet')
    self.last_transcript_snippet = attributes[:'last_transcript_snippet']
  end

  if attributes.key?(:'transcript')
    if (value = attributes[:'transcript']).is_a?(Array)
      self.transcript = value
    end
  end

  if attributes.key?(:'billing')
    self.billing = attributes[:'billing']
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  end
end

Instance Attribute Details

#_idObject

Returns the value of attribute _id.



19
20
21
# File 'lib/zernio-sdk/models/call_record.rb', line 19

def _id
  @_id
end

#account_idObject

Owning social account. The unified /v1/calls/id detail + recording endpoints work for any channel; the channel-specific endpoints remain for account-scoped access.



22
23
24
# File 'lib/zernio-sdk/models/call_record.rb', line 22

def 
  @account_id
end

#amdObject

Outbound answering-machine detection was requested for this call.



52
53
54
# File 'lib/zernio-sdk/models/call_record.rb', line 52

def amd
  @amd
end

#answered_atObject

Returns the value of attribute answered_at.



69
70
71
# File 'lib/zernio-sdk/models/call_record.rb', line 69

def answered_at
  @answered_at
end

#answered_machineObject

With amd, whether a machine (vs a human) answered.



55
56
57
# File 'lib/zernio-sdk/models/call_record.rb', line 55

def answered_machine
  @answered_machine
end

#billingObject

Returns the value of attribute billing.



98
99
100
# File 'lib/zernio-sdk/models/call_record.rb', line 98

def billing
  @billing
end

#call_errorsObject

Per-call failure log (dial failed, bridge failed, recording error).



87
88
89
# File 'lib/zernio-sdk/models/call_record.rb', line 87

def call_errors
  @call_errors
end

#channelObject

Returns the value of attribute channel.



30
31
32
# File 'lib/zernio-sdk/models/call_record.rb', line 30

def channel
  @channel
end

#contact_idObject

CRM Contact for the counterparty, when resolved.



28
29
30
# File 'lib/zernio-sdk/models/call_record.rb', line 28

def contact_id
  @contact_id
end

#conversation_idObject

Inbox conversation with the counterparty, when one exists.



25
26
27
# File 'lib/zernio-sdk/models/call_record.rb', line 25

def conversation_id
  @conversation_id
end

#created_atObject

Returns the value of attribute created_at.



100
101
102
# File 'lib/zernio-sdk/models/call_record.rb', line 100

def created_at
  @created_at
end

#directionObject

Returns the value of attribute direction.



32
33
34
# File 'lib/zernio-sdk/models/call_record.rb', line 32

def direction
  @direction
end

#duration_secondsObject

Returns the value of attribute duration_seconds.



76
77
78
# File 'lib/zernio-sdk/models/call_record.rb', line 76

def duration_seconds
  @duration_seconds
end

#end_reasonObject

Returns the value of attribute end_reason.



78
79
80
# File 'lib/zernio-sdk/models/call_record.rb', line 78

def end_reason
  @end_reason
end

#ended_atObject

Returns the value of attribute ended_at.



71
72
73
# File 'lib/zernio-sdk/models/call_record.rb', line 71

def ended_at
  @ended_at
end

#forward_caller_idObject

Caller ID presented on the forwarded leg.



58
59
60
# File 'lib/zernio-sdk/models/call_record.rb', line 58

def forward_caller_id
  @forward_caller_id
end

#forward_toObject

Destination the call was routed to (tel:/sip:/wss:), snapshotted at routing time.



41
42
43
# File 'lib/zernio-sdk/models/call_record.rb', line 41

def forward_to
  @forward_to
end

#fromObject

Caller number (E.164).



35
36
37
# File 'lib/zernio-sdk/models/call_record.rb', line 35

def from
  @from
end

#greetingObject

Outbound PSTN only. Message spoken to the callee on answer, before the bridge.



44
45
46
# File 'lib/zernio-sdk/models/call_record.rb', line 44

def greeting
  @greeting
end

#hangup_causeObject

Raw carrier hangup cause behind endReason (e.g. normal_clearing, not_found, time_limit) — the actual motive when endReason is a coarse bucket.



81
82
83
# File 'lib/zernio-sdk/models/call_record.rb', line 81

def hangup_cause
  @hangup_cause
end

#is_voicemailObject

True when an inbound call went to voicemail.



49
50
51
# File 'lib/zernio-sdk/models/call_record.rb', line 49

def is_voicemail
  @is_voicemail
end

#last_transcript_snippetObject

Most recent transcript segment, for list previews.



93
94
95
# File 'lib/zernio-sdk/models/call_record.rb', line 93

def last_transcript_snippet
  @last_transcript_snippet
end

#recording_enabledObject

Effective flag for THIS call (number default + per-call override, resolved at create time).



61
62
63
# File 'lib/zernio-sdk/models/call_record.rb', line 61

def recording_enabled
  @recording_enabled
end

#recording_urlObject

May be expired. Resolve a fresh playable URL via GET /v1/calls/id/recording (any channel).



90
91
92
# File 'lib/zernio-sdk/models/call_record.rb', line 90

def recording_url
  @recording_url
end

#sip_hangup_causeObject

SIP response code that ended the call, when SIP-signalled (e.g. '403', '488'). The real failure reason for SIP legs.



84
85
86
# File 'lib/zernio-sdk/models/call_record.rb', line 84

def sip_hangup_cause
  @sip_hangup_cause
end

#started_atObject

Returns the value of attribute started_at.



67
68
69
# File 'lib/zernio-sdk/models/call_record.rb', line 67

def started_at
  @started_at
end

#statusObject

Returns the value of attribute status.



46
47
48
# File 'lib/zernio-sdk/models/call_record.rb', line 46

def status
  @status
end

#toObject

Callee number (E.164).



38
39
40
# File 'lib/zernio-sdk/models/call_record.rb', line 38

def to
  @to
end

#transcriptObject

Full transcript segments (detail endpoint only; omitted from lists).



96
97
98
# File 'lib/zernio-sdk/models/call_record.rb', line 96

def transcript
  @transcript
end

#transcription_enabledObject

Returns the value of attribute transcription_enabled.



63
64
65
# File 'lib/zernio-sdk/models/call_record.rb', line 63

def transcription_enabled
  @transcription_enabled
end

#transcription_languageObject

Returns the value of attribute transcription_language.



65
66
67
# File 'lib/zernio-sdk/models/call_record.rb', line 65

def transcription_language
  @transcription_language
end

#transferred_atObject

When the call was blind-transferred (POST /v1/voice/calls/id/transfer).



74
75
76
# File 'lib/zernio-sdk/models/call_record.rb', line 74

def transferred_at
  @transferred_at
end

#updated_atObject

Returns the value of attribute updated_at.



102
103
104
# File 'lib/zernio-sdk/models/call_record.rb', line 102

def updated_at
  @updated_at
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



166
167
168
# File 'lib/zernio-sdk/models/call_record.rb', line 166

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



171
172
173
# File 'lib/zernio-sdk/models/call_record.rb', line 171

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/zernio-sdk/models/call_record.rb', line 127

def self.attribute_map
  {
    :'_id' => :'_id',
    :'account_id' => :'accountId',
    :'conversation_id' => :'conversationId',
    :'contact_id' => :'contactId',
    :'channel' => :'channel',
    :'direction' => :'direction',
    :'from' => :'from',
    :'to' => :'to',
    :'forward_to' => :'forwardTo',
    :'greeting' => :'greeting',
    :'status' => :'status',
    :'is_voicemail' => :'isVoicemail',
    :'amd' => :'amd',
    :'answered_machine' => :'answeredMachine',
    :'forward_caller_id' => :'forwardCallerId',
    :'recording_enabled' => :'recordingEnabled',
    :'transcription_enabled' => :'transcriptionEnabled',
    :'transcription_language' => :'transcriptionLanguage',
    :'started_at' => :'startedAt',
    :'answered_at' => :'answeredAt',
    :'ended_at' => :'endedAt',
    :'transferred_at' => :'transferredAt',
    :'duration_seconds' => :'durationSeconds',
    :'end_reason' => :'endReason',
    :'hangup_cause' => :'hangupCause',
    :'sip_hangup_cause' => :'sipHangupCause',
    :'call_errors' => :'callErrors',
    :'recording_url' => :'recordingUrl',
    :'last_transcript_snippet' => :'lastTranscriptSnippet',
    :'transcript' => :'transcript',
    :'billing' => :'billing',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
# File 'lib/zernio-sdk/models/call_record.rb', line 527

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/zernio-sdk/models/call_record.rb', line 215

def self.openapi_nullable
  Set.new([
    :'conversation_id',
    :'contact_id',
    :'forward_to',
    :'greeting',
    :'answered_machine',
    :'answered_at',
    :'ended_at',
    :'transferred_at',
    :'hangup_cause',
    :'sip_hangup_cause',
    :'recording_url',
    :'last_transcript_snippet',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/zernio-sdk/models/call_record.rb', line 176

def self.openapi_types
  {
    :'_id' => :'String',
    :'account_id' => :'String',
    :'conversation_id' => :'String',
    :'contact_id' => :'String',
    :'channel' => :'String',
    :'direction' => :'String',
    :'from' => :'String',
    :'to' => :'String',
    :'forward_to' => :'String',
    :'greeting' => :'String',
    :'status' => :'String',
    :'is_voicemail' => :'Boolean',
    :'amd' => :'Boolean',
    :'answered_machine' => :'Boolean',
    :'forward_caller_id' => :'String',
    :'recording_enabled' => :'Boolean',
    :'transcription_enabled' => :'Boolean',
    :'transcription_language' => :'String',
    :'started_at' => :'Time',
    :'answered_at' => :'Time',
    :'ended_at' => :'Time',
    :'transferred_at' => :'Time',
    :'duration_seconds' => :'Integer',
    :'end_reason' => :'String',
    :'hangup_cause' => :'String',
    :'sip_hangup_cause' => :'String',
    :'call_errors' => :'Array<CallRecordCallErrorsInner>',
    :'recording_url' => :'String',
    :'last_transcript_snippet' => :'String',
    :'transcript' => :'Array<CallRecordTranscriptInner>',
    :'billing' => :'CallRecordBilling',
    :'created_at' => :'Time',
    :'updated_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/zernio-sdk/models/call_record.rb', line 474

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _id == o._id &&
       == o. &&
      conversation_id == o.conversation_id &&
      contact_id == o.contact_id &&
      channel == o.channel &&
      direction == o.direction &&
      from == o.from &&
      to == o.to &&
      forward_to == o.forward_to &&
      greeting == o.greeting &&
      status == o.status &&
      is_voicemail == o.is_voicemail &&
      amd == o.amd &&
      answered_machine == o.answered_machine &&
      forward_caller_id == o.forward_caller_id &&
      recording_enabled == o.recording_enabled &&
      transcription_enabled == o.transcription_enabled &&
      transcription_language == o.transcription_language &&
      started_at == o.started_at &&
      answered_at == o.answered_at &&
      ended_at == o.ended_at &&
      transferred_at == o.transferred_at &&
      duration_seconds == o.duration_seconds &&
      end_reason == o.end_reason &&
      hangup_cause == o.hangup_cause &&
      sip_hangup_cause == o.sip_hangup_cause &&
      call_errors == o.call_errors &&
      recording_url == o.recording_url &&
      last_transcript_snippet == o.last_transcript_snippet &&
      transcript == o.transcript &&
      billing == o.billing &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


514
515
516
# File 'lib/zernio-sdk/models/call_record.rb', line 514

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



520
521
522
# File 'lib/zernio-sdk/models/call_record.rb', line 520

def hash
  [_id, , conversation_id, contact_id, channel, direction, from, to, forward_to, greeting, status, is_voicemail, amd, answered_machine, forward_caller_id, recording_enabled, transcription_enabled, transcription_language, started_at, answered_at, ended_at, transferred_at, duration_seconds, end_reason, hangup_cause, sip_hangup_cause, call_errors, recording_url, last_transcript_snippet, transcript, billing, created_at, updated_at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



387
388
389
390
391
# File 'lib/zernio-sdk/models/call_record.rb', line 387

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/zernio-sdk/models/call_record.rb', line 549

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/zernio-sdk/models/call_record.rb', line 395

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  channel_validator = EnumAttributeValidator.new('String', ["whatsapp", "pstn"])
  return false unless channel_validator.valid?(@channel)
  direction_validator = EnumAttributeValidator.new('String', ["inbound", "outbound"])
  return false unless direction_validator.valid?(@direction)
  status_validator = EnumAttributeValidator.new('String', ["ringing", "answered", "ended", "failed"])
  return false unless status_validator.valid?(@status)
  forward_caller_id_validator = EnumAttributeValidator.new('String', ["business", "caller"])
  return false unless forward_caller_id_validator.valid?(@forward_caller_id)
  transcription_language_validator = EnumAttributeValidator.new('String', ["auto", "en", "es"])
  return false unless transcription_language_validator.valid?(@transcription_language)
  end_reason_validator = EnumAttributeValidator.new('String', ["hangup", "no_answer", "rejected", "error"])
  return false unless end_reason_validator.valid?(@end_reason)
  true
end