Class: Zernio::VoiceApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/voice_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ VoiceApi

Returns a new instance of VoiceApi.



19
20
21
# File 'lib/zernio-sdk/api/voice_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/voice_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#attach_number_to_sip_trunk(id, attach_number_to_sip_trunk_request, opts = {}) ⇒ AttachNumberToSipTrunk200Response

Attach a number to a SIP trunk Routes the number's calls to the trunk: the external platform receives its inbound directly and can present it as outbound caller ID. While attached, Zernio-side voice features are off for this number (call forwarding, IVR, voicemail, recording, the softphone, and WhatsApp calling), so the number must have Calls and WhatsApp calling disabled before attaching. SMS and WhatsApp messaging are unaffected.

Parameters:

  • id (String)

    Phone number record ID (from GET /v1/phone-numbers).

  • attach_number_to_sip_trunk_request (AttachNumberToSipTrunkRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/zernio-sdk/api/voice_api.rb', line 28

def attach_number_to_sip_trunk(id, attach_number_to_sip_trunk_request, opts = {})
  data, _status_code, _headers = attach_number_to_sip_trunk_with_http_info(id, attach_number_to_sip_trunk_request, opts)
  data
end

#attach_number_to_sip_trunk_with_http_info(id, attach_number_to_sip_trunk_request, opts = {}) ⇒ Array<(AttachNumberToSipTrunk200Response, Integer, Hash)>

Attach a number to a SIP trunk Routes the number's calls to the trunk: the external platform receives its inbound directly and can present it as outbound caller ID. While attached, Zernio-side voice features are off for this number (call forwarding, IVR, voicemail, recording, the softphone, and WhatsApp calling), so the number must have Calls and WhatsApp calling disabled before attaching. SMS and WhatsApp messaging are unaffected.

Parameters:

  • id (String)

    Phone number record ID (from GET /v1/phone-numbers).

  • attach_number_to_sip_trunk_request (AttachNumberToSipTrunkRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
# File 'lib/zernio-sdk/api/voice_api.rb', line 39

def attach_number_to_sip_trunk_with_http_info(id, attach_number_to_sip_trunk_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.attach_number_to_sip_trunk ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.attach_number_to_sip_trunk"
  end
  # verify the required parameter 'attach_number_to_sip_trunk_request' is set
  if @api_client.config.client_side_validation && attach_number_to_sip_trunk_request.nil?
    fail ArgumentError, "Missing the required parameter 'attach_number_to_sip_trunk_request' when calling VoiceApi.attach_number_to_sip_trunk"
  end
  # resource path
  local_var_path = '/v1/phone-numbers/{id}/sip-trunk'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(attach_number_to_sip_trunk_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AttachNumberToSipTrunk200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.attach_number_to_sip_trunk",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#attach_number_to_sip_trunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_sip_trunk(create_sip_trunk_request, opts = {}) ⇒ CreateSipTrunk201Response

Create a SIP trunk Creates a SIP trunk an external voice platform (Retell, ElevenLabs, Vapi, or any SIP endpoint) can import your Zernio numbers into. The trunk carries both directions: inbound calls on attached numbers are delivered to sipHost, and the platform originates outbound calls through termination.uri with the digest credentials. The digestPassword is returned only by this call (and by rotate-credentials); store it immediately. Attach any number of numbers to a trunk. Several trunks may point at the same host — each carries its own credentials and spend cap, so separate destination workspaces (e.g. an agency's clients) stay isolated.

Parameters:

  • create_sip_trunk_request (CreateSipTrunkRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



101
102
103
104
# File 'lib/zernio-sdk/api/voice_api.rb', line 101

def create_sip_trunk(create_sip_trunk_request, opts = {})
  data, _status_code, _headers = create_sip_trunk_with_http_info(create_sip_trunk_request, opts)
  data
end

#create_sip_trunk_with_http_info(create_sip_trunk_request, opts = {}) ⇒ Array<(CreateSipTrunk201Response, Integer, Hash)>

Create a SIP trunk Creates a SIP trunk an external voice platform (Retell, ElevenLabs, Vapi, or any SIP endpoint) can import your Zernio numbers into. The trunk carries both directions: inbound calls on attached numbers are delivered to `sipHost`, and the platform originates outbound calls through `termination.uri` with the digest credentials. The `digestPassword` is returned only by this call (and by rotate-credentials); store it immediately. Attach any number of numbers to a trunk. Several trunks may point at the same host — each carries its own credentials and spend cap, so separate destination workspaces (e.g. an agency's clients) stay isolated.

Parameters:

  • create_sip_trunk_request (CreateSipTrunkRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CreateSipTrunk201Response, Integer, Hash)>)

    CreateSipTrunk201Response data, response status code and response headers



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
# File 'lib/zernio-sdk/api/voice_api.rb', line 111

def create_sip_trunk_with_http_info(create_sip_trunk_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.create_sip_trunk ...'
  end
  # verify the required parameter 'create_sip_trunk_request' is set
  if @api_client.config.client_side_validation && create_sip_trunk_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_sip_trunk_request' when calling VoiceApi.create_sip_trunk"
  end
  # resource path
  local_var_path = '/v1/phone-numbers/sip-trunks'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_sip_trunk_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateSipTrunk201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.create_sip_trunk",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#create_sip_trunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_voice_call(create_voice_call_request, opts = {}) ⇒ CreateVoiceCall200Response

Place an outbound phone call Dials to FROM one of your voice-enabled numbers and, on answer, bridges the callee to the number's stored forward destination, or to the per-call forwardTo override. Destinations can be your own AI voice agent (Vapi/Retell), a phone, or a SIP endpoint. An optional greeting is spoken to the callee before the bridge. The 200 response means the call is dialing; the lifecycle continues asynchronously (track it via GET /v1/voice/calls/{id} or the call.* webhooks). Outbound calls are capped per rolling hour (429 when hit). Idempotency: send an Idempotency-Key header to make retries safe; same key + same body replays the original response instead of dialing (and billing) a second call.

Parameters:

  • create_voice_call_request (CreateVoiceCallRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    Optional client-generated unique key (e.g. a UUID) that makes retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.

Returns:



170
171
172
173
# File 'lib/zernio-sdk/api/voice_api.rb', line 170

def create_voice_call(create_voice_call_request, opts = {})
  data, _status_code, _headers = create_voice_call_with_http_info(create_voice_call_request, opts)
  data
end

#create_voice_call_with_http_info(create_voice_call_request, opts = {}) ⇒ Array<(CreateVoiceCall200Response, Integer, Hash)>

Place an outbound phone call Dials `to` FROM one of your voice-enabled numbers and, on answer, bridges the callee to the number's stored forward destination, or to the per-call `forwardTo` override. Destinations can be your own AI voice agent (Vapi/Retell), a phone, or a SIP endpoint. An optional `greeting` is spoken to the callee before the bridge. The 200 response means the call is dialing; the lifecycle continues asynchronously (track it via `GET /v1/voice/calls/id` or the `call.*` webhooks). Outbound calls are capped per rolling hour (429 when hit). Idempotency: send an `Idempotency-Key` header to make retries safe; same key + same body replays the original response instead of dialing (and billing) a second call.

Parameters:

  • create_voice_call_request (CreateVoiceCallRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    Optional client-generated unique key (e.g. a UUID) that makes retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.

Returns:

  • (Array<(CreateVoiceCall200Response, Integer, Hash)>)

    CreateVoiceCall200Response data, response status code and response headers



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
# File 'lib/zernio-sdk/api/voice_api.rb', line 181

def create_voice_call_with_http_info(create_voice_call_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.create_voice_call ...'
  end
  # verify the required parameter 'create_voice_call_request' is set
  if @api_client.config.client_side_validation && create_voice_call_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_voice_call_request' when calling VoiceApi.create_voice_call"
  end
  if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling VoiceApi.create_voice_call, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/v1/voice/calls'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_voice_call_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateVoiceCall200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.create_voice_call",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#create_voice_call\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_voice_web_session(opts = {}) ⇒ CreateVoiceWebSession200Response

Mint a browser softphone session Step 1 of the two-step browser softphone handshake. Mints a WebRTC session (token + credential) the browser registers with the @telnyx/webrtc SDK. Once registered, call POST /v1/voice/calls/web/dial with the returned credentialId to place the call. The split avoids bridging to a browser that has not finished registering. The token lives ~1 hour (it must outlive the whole call, not just the handshake).

Parameters:

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

    the optional parameters

Returns:



243
244
245
246
# File 'lib/zernio-sdk/api/voice_api.rb', line 243

def create_voice_web_session(opts = {})
  data, _status_code, _headers = create_voice_web_session_with_http_info(opts)
  data
end

#create_voice_web_session_with_http_info(opts = {}) ⇒ Array<(CreateVoiceWebSession200Response, Integer, Hash)>

Mint a browser softphone session Step 1 of the two-step browser softphone handshake. Mints a WebRTC session (token + credential) the browser registers with the `@telnyx/webrtc` SDK. Once registered, call `POST /v1/voice/calls/web/dial` with the returned `credentialId` to place the call. The split avoids bridging to a browser that has not finished registering. The token lives ~1 hour (it must outlive the whole call, not just the handshake).

Parameters:

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

    the optional parameters

Returns:



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
# File 'lib/zernio-sdk/api/voice_api.rb', line 252

def create_voice_web_session_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.create_voice_web_session ...'
  end
  # resource path
  local_var_path = '/v1/voice/calls/web'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CreateVoiceWebSession200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.create_voice_web_session",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#create_voice_web_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_sip_trunk(id, opts = {}) ⇒ DeleteSmsSenderId200Response

Delete a SIP trunk Tears down the trunk and its carrier-side objects. Refused while any number is still attached: detach them first.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



301
302
303
304
# File 'lib/zernio-sdk/api/voice_api.rb', line 301

def delete_sip_trunk(id, opts = {})
  data, _status_code, _headers = delete_sip_trunk_with_http_info(id, opts)
  data
end

#delete_sip_trunk_with_http_info(id, opts = {}) ⇒ Array<(DeleteSmsSenderId200Response, Integer, Hash)>

Delete a SIP trunk Tears down the trunk and its carrier-side objects. Refused while any number is still attached: detach them first.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
# File 'lib/zernio-sdk/api/voice_api.rb', line 311

def delete_sip_trunk_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.delete_sip_trunk ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.delete_sip_trunk"
  end
  # resource path
  local_var_path = '/v1/phone-numbers/sip-trunks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteSmsSenderId200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.delete_sip_trunk",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#delete_sip_trunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#detach_number_from_sip_trunk(id, opts = {}) ⇒ DetachNumberFromSipTrunk200Response

Detach a number from its SIP trunk Returns the number's calls to Zernio routing. Idempotent when the number is not attached to any trunk.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



364
365
366
367
# File 'lib/zernio-sdk/api/voice_api.rb', line 364

def detach_number_from_sip_trunk(id, opts = {})
  data, _status_code, _headers = detach_number_from_sip_trunk_with_http_info(id, opts)
  data
end

#detach_number_from_sip_trunk_with_http_info(id, opts = {}) ⇒ Array<(DetachNumberFromSipTrunk200Response, Integer, Hash)>

Detach a number from its SIP trunk Returns the number's calls to Zernio routing. Idempotent when the number is not attached to any trunk.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
# File 'lib/zernio-sdk/api/voice_api.rb', line 374

def detach_number_from_sip_trunk_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.detach_number_from_sip_trunk ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.detach_number_from_sip_trunk"
  end
  # resource path
  local_var_path = '/v1/phone-numbers/{id}/sip-trunk'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DetachNumberFromSipTrunk200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.detach_number_from_sip_trunk",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#detach_number_from_sip_trunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#dial_voice_web_call(dial_voice_web_call_request, opts = {}) ⇒ DialVoiceWebCall200Response

Dial from the browser softphone Step 2 of the browser softphone handshake: places an outbound call whose answered leg is bridged to the browser registered with the credential from POST /v1/voice/calls/web. The call runs through the normal outbound lane, so it is logged as outbound (from = your number, to = target) and recorded per the number's settings.

Parameters:

Returns:



427
428
429
430
# File 'lib/zernio-sdk/api/voice_api.rb', line 427

def dial_voice_web_call(dial_voice_web_call_request, opts = {})
  data, _status_code, _headers = dial_voice_web_call_with_http_info(dial_voice_web_call_request, opts)
  data
end

#dial_voice_web_call_with_http_info(dial_voice_web_call_request, opts = {}) ⇒ Array<(DialVoiceWebCall200Response, Integer, Hash)>

Dial from the browser softphone Step 2 of the browser softphone handshake: places an outbound call whose answered leg is bridged to the browser registered with the credential from `POST /v1/voice/calls/web`. The call runs through the normal outbound lane, so it is logged as outbound (from = your number, to = target) and recorded per the number's settings.

Parameters:

Returns:

  • (Array<(DialVoiceWebCall200Response, Integer, Hash)>)

    DialVoiceWebCall200Response data, response status code and response headers



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
482
483
484
485
486
487
488
# File 'lib/zernio-sdk/api/voice_api.rb', line 437

def dial_voice_web_call_with_http_info(dial_voice_web_call_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.dial_voice_web_call ...'
  end
  # verify the required parameter 'dial_voice_web_call_request' is set
  if @api_client.config.client_side_validation && dial_voice_web_call_request.nil?
    fail ArgumentError, "Missing the required parameter 'dial_voice_web_call_request' when calling VoiceApi.dial_voice_web_call"
  end
  # resource path
  local_var_path = '/v1/voice/calls/web/dial'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(dial_voice_web_call_request)

  # return_type
  return_type = opts[:debug_return_type] || 'DialVoiceWebCall200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.dial_voice_web_call",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#dial_voice_web_call\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#disable_voice_on_number(id, opts = {}) ⇒ DisableVoiceOnNumber200Response

Disable phone calling on a number Turns off PSTN calling for the number. The stored forward destination and settings are preserved, so re-enabling restores the prior config.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



495
496
497
498
# File 'lib/zernio-sdk/api/voice_api.rb', line 495

def disable_voice_on_number(id, opts = {})
  data, _status_code, _headers = disable_voice_on_number_with_http_info(id, opts)
  data
end

#disable_voice_on_number_with_http_info(id, opts = {}) ⇒ Array<(DisableVoiceOnNumber200Response, Integer, Hash)>

Disable phone calling on a number Turns off PSTN calling for the number. The stored forward destination and settings are preserved, so re-enabling restores the prior config.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/zernio-sdk/api/voice_api.rb', line 505

def disable_voice_on_number_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.disable_voice_on_number ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.disable_voice_on_number"
  end
  # resource path
  local_var_path = '/v1/phone-numbers/{id}/voice'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DisableVoiceOnNumber200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.disable_voice_on_number",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#disable_voice_on_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#enable_voice_on_number(id, opts = {}) ⇒ EnableVoiceOnNumber200Response

Enable phone calling on a number Turns on regular phone (PSTN) calling for one of your numbers and configures how inbound calls are handled. Inbound calls route to forwardTo: your own AI voice agent (Vapi/Retell), a phone, or a SIP endpoint. Optional extras: voicemail, business-hours windows, an IVR menu, a caller blocklist, recording, and transcription. A number can also be voice-enabled with no forward (outbound-only). Idempotent, and doubles as the settings update: only fields present in the body are written. Omitting forwardTo preserves the current destination; sending an empty string clears it.

Parameters:

  • id (String)

    Phone number record ID (from GET /v1/phone-numbers).

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

    the optional parameters

Options Hash (opts):

Returns:



559
560
561
562
# File 'lib/zernio-sdk/api/voice_api.rb', line 559

def enable_voice_on_number(id, opts = {})
  data, _status_code, _headers = enable_voice_on_number_with_http_info(id, opts)
  data
end

#enable_voice_on_number_with_http_info(id, opts = {}) ⇒ Array<(EnableVoiceOnNumber200Response, Integer, Hash)>

Enable phone calling on a number Turns on regular phone (PSTN) calling for one of your numbers and configures how inbound calls are handled. Inbound calls route to `forwardTo`: your own AI voice agent (Vapi/Retell), a phone, or a SIP endpoint. Optional extras: voicemail, business-hours windows, an IVR menu, a caller blocklist, recording, and transcription. A number can also be voice-enabled with no forward (outbound-only). Idempotent, and doubles as the settings update: only fields present in the body are written. Omitting `forwardTo` preserves the current destination; sending an empty string clears it.

Parameters:

  • id (String)

    Phone number record ID (from GET /v1/phone-numbers).

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

    the optional parameters

Options Hash (opts):

Returns:



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/zernio-sdk/api/voice_api.rb', line 570

def enable_voice_on_number_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.enable_voice_on_number ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.enable_voice_on_number"
  end
  # resource path
  local_var_path = '/v1/phone-numbers/{id}/voice'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'enable_voice_on_number_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'EnableVoiceOnNumber200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.enable_voice_on_number",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#enable_voice_on_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#end_voice_call(id, opts = {}) ⇒ EndVoiceCall200Response

Hang up a live call Hangs up a live call on demand. Idempotent: ending a call that already ended (or never connected) returns success with the call's current status. Final duration/cost are written asynchronously when the hangup event lands, so the call doc may briefly still show its prior status.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



628
629
630
631
# File 'lib/zernio-sdk/api/voice_api.rb', line 628

def end_voice_call(id, opts = {})
  data, _status_code, _headers = end_voice_call_with_http_info(id, opts)
  data
end

#end_voice_call_with_http_info(id, opts = {}) ⇒ Array<(EndVoiceCall200Response, Integer, Hash)>

Hang up a live call Hangs up a live call on demand. Idempotent: ending a call that already ended (or never connected) returns success with the call's current status. Final duration/cost are written asynchronously when the hangup event lands, so the call doc may briefly still show its prior status.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(EndVoiceCall200Response, Integer, Hash)>)

    EndVoiceCall200Response data, response status code and response headers



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# File 'lib/zernio-sdk/api/voice_api.rb', line 638

def end_voice_call_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.end_voice_call ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.end_voice_call"
  end
  # resource path
  local_var_path = '/v1/voice/calls/{id}/end'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'EndVoiceCall200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.end_voice_call",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#end_voice_call\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_sip_trunk(id, opts = {}) ⇒ GetSipTrunk200Response

Get a SIP trunk

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



690
691
692
693
# File 'lib/zernio-sdk/api/voice_api.rb', line 690

def get_sip_trunk(id, opts = {})
  data, _status_code, _headers = get_sip_trunk_with_http_info(id, opts)
  data
end

#get_sip_trunk_with_http_info(id, opts = {}) ⇒ Array<(GetSipTrunk200Response, Integer, Hash)>

Get a SIP trunk

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetSipTrunk200Response, Integer, Hash)>)

    GetSipTrunk200Response data, response status code and response headers



699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
# File 'lib/zernio-sdk/api/voice_api.rb', line 699

def get_sip_trunk_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.get_sip_trunk ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.get_sip_trunk"
  end
  # resource path
  local_var_path = '/v1/phone-numbers/sip-trunks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetSipTrunk200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.get_sip_trunk",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#get_sip_trunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_voice_call(id, opts = {}) ⇒ GetVoiceCall200Response

Get a phone call Full call detail, including the transcript segments when transcription was on.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



752
753
754
755
# File 'lib/zernio-sdk/api/voice_api.rb', line 752

def get_voice_call(id, opts = {})
  data, _status_code, _headers = get_voice_call_with_http_info(id, opts)
  data
end

#get_voice_call_estimate(to, opts = {}) ⇒ GetVoiceCallEstimate200Response

Estimate call cost Pre-call cost estimate for a PSTN call: the carrier leg plus optional recording and transcription add-ons. Same billing formula as the post-call invoice, so the quote and the final charge can't disagree. The per-minute figure is deliberately conservative (the real cost comes from the settled carrier record after the call), so estimates trend slightly over the actual invoice. Parity endpoint of GET /v1/whatsapp/calls/estimate, minus the Meta line (PSTN calls have no separate Meta bill, so totalCostUSD equals billableCostUSD).

Parameters:

  • to (String)

    Destination number, E.164 (leading + optional).

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

    the optional parameters

Options Hash (opts):

  • :minutes (Integer) — default: default to 1
  • :recording (Boolean)
  • :transcription (Boolean)

Returns:



818
819
820
821
# File 'lib/zernio-sdk/api/voice_api.rb', line 818

def get_voice_call_estimate(to, opts = {})
  data, _status_code, _headers = get_voice_call_estimate_with_http_info(to, opts)
  data
end

#get_voice_call_estimate_with_http_info(to, opts = {}) ⇒ Array<(GetVoiceCallEstimate200Response, Integer, Hash)>

Estimate call cost Pre-call cost estimate for a PSTN call: the carrier leg plus optional recording and transcription add-ons. Same billing formula as the post-call invoice, so the quote and the final charge can't disagree. The per-minute figure is deliberately conservative (the real cost comes from the settled carrier record after the call), so estimates trend slightly over the actual invoice. Parity endpoint of `GET /v1/whatsapp/calls/estimate`, minus the Meta line (PSTN calls have no separate Meta bill, so `totalCostUSD` equals `billableCostUSD`).

Parameters:

  • to (String)

    Destination number, E.164 (leading + optional).

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

    the optional parameters

Options Hash (opts):

  • :minutes (Integer) — default: default to 1
  • :recording (Boolean)
  • :transcription (Boolean)

Returns:



831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
# File 'lib/zernio-sdk/api/voice_api.rb', line 831

def get_voice_call_estimate_with_http_info(to, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.get_voice_call_estimate ...'
  end
  # verify the required parameter 'to' is set
  if @api_client.config.client_side_validation && to.nil?
    fail ArgumentError, "Missing the required parameter 'to' when calling VoiceApi.get_voice_call_estimate"
  end
  if @api_client.config.client_side_validation && !opts[:'minutes'].nil? && opts[:'minutes'] > 120
    fail ArgumentError, 'invalid value for "opts[:"minutes"]" when calling VoiceApi.get_voice_call_estimate, must be smaller than or equal to 120.'
  end

  if @api_client.config.client_side_validation && !opts[:'minutes'].nil? && opts[:'minutes'] < 1
    fail ArgumentError, 'invalid value for "opts[:"minutes"]" when calling VoiceApi.get_voice_call_estimate, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/voice/calls/estimate'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'to'] = to
  query_params[:'minutes'] = opts[:'minutes'] if !opts[:'minutes'].nil?
  query_params[:'recording'] = opts[:'recording'] if !opts[:'recording'].nil?
  query_params[:'transcription'] = opts[:'transcription'] if !opts[:'transcription'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetVoiceCallEstimate200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.get_voice_call_estimate",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#get_voice_call_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_voice_call_recording(id, opts = {}) ⇒ GetWhatsAppCallRecording200Response

Get a call recording Resolves a fresh, playable MP3 URL for the call's recording (provider-signed URLs expire ~10 minutes after signing, so this endpoint re-signs on demand). Default responds 302 Found redirecting to the fresh URL; pass as=json to receive { url } instead.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :as (String)

    `json` returns `{ url }` instead of a 302 redirect.

Returns:



897
898
899
900
# File 'lib/zernio-sdk/api/voice_api.rb', line 897

def get_voice_call_recording(id, opts = {})
  data, _status_code, _headers = get_voice_call_recording_with_http_info(id, opts)
  data
end

#get_voice_call_recording_with_http_info(id, opts = {}) ⇒ Array<(GetWhatsAppCallRecording200Response, Integer, Hash)>

Get a call recording Resolves a fresh, playable MP3 URL for the call's recording (provider-signed URLs expire ~10 minutes after signing, so this endpoint re-signs on demand). Default responds `302 Found` redirecting to the fresh URL; pass `as=json` to receive `{ url }` instead.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :as (String)

    `json` returns `{ url }` instead of a 302 redirect.

Returns:



908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
# File 'lib/zernio-sdk/api/voice_api.rb', line 908

def get_voice_call_recording_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.get_voice_call_recording ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.get_voice_call_recording"
  end
  allowable_values = ["json"]
  if @api_client.config.client_side_validation && opts[:'as'] && !allowable_values.include?(opts[:'as'])
    fail ArgumentError, "invalid value for \"as\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/voice/calls/{id}/recording'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'as'] = opts[:'as'] if !opts[:'as'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetWhatsAppCallRecording200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.get_voice_call_recording",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#get_voice_call_recording\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_voice_call_with_http_info(id, opts = {}) ⇒ Array<(GetVoiceCall200Response, Integer, Hash)>

Get a phone call Full call detail, including the transcript segments when transcription was on.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetVoiceCall200Response, Integer, Hash)>)

    GetVoiceCall200Response data, response status code and response headers



762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
# File 'lib/zernio-sdk/api/voice_api.rb', line 762

def get_voice_call_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.get_voice_call ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.get_voice_call"
  end
  # resource path
  local_var_path = '/v1/voice/calls/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetVoiceCall200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.get_voice_call",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#get_voice_call\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_sip_trunks(opts = {}) ⇒ ListSipTrunks200Response

List SIP trunks

Parameters:

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

    the optional parameters

Returns:



964
965
966
967
# File 'lib/zernio-sdk/api/voice_api.rb', line 964

def list_sip_trunks(opts = {})
  data, _status_code, _headers = list_sip_trunks_with_http_info(opts)
  data
end

#list_sip_trunks_with_http_info(opts = {}) ⇒ Array<(ListSipTrunks200Response, Integer, Hash)>

List SIP trunks

Parameters:

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

    the optional parameters

Returns:

  • (Array<(ListSipTrunks200Response, Integer, Hash)>)

    ListSipTrunks200Response data, response status code and response headers



972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
# File 'lib/zernio-sdk/api/voice_api.rb', line 972

def list_sip_trunks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.list_sip_trunks ...'
  end
  # resource path
  local_var_path = '/v1/phone-numbers/sip-trunks'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListSipTrunks200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.list_sip_trunks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#list_sip_trunks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_voice_calls(opts = {}) ⇒ ListVoiceCalls200Response

List phone calls Your PSTN voice calls (inbound + outbound), newest first. Cursor pagination: pass the returned nextCursor as before for the next page. For a history that also includes WhatsApp calls, use GET /v1/calls.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :direction (String)
  • :number (String)

    Exact filter: calls involving this number (typically one of your DIDs). E.164, leading + optional.

  • :before (Time)
  • :limit (Integer) — default: default to 50

Returns:



1025
1026
1027
1028
# File 'lib/zernio-sdk/api/voice_api.rb', line 1025

def list_voice_calls(opts = {})
  data, _status_code, _headers = list_voice_calls_with_http_info(opts)
  data
end

#list_voice_calls_with_http_info(opts = {}) ⇒ Array<(ListVoiceCalls200Response, Integer, Hash)>

List phone calls Your PSTN voice calls (inbound + outbound), newest first. Cursor pagination: pass the returned `nextCursor` as `before` for the next page. For a history that also includes WhatsApp calls, use `GET /v1/calls`.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :direction (String)
  • :number (String)

    Exact filter: calls involving this number (typically one of your DIDs). E.164, leading + optional.

  • :before (Time)
  • :limit (Integer) — default: default to 50

Returns:

  • (Array<(ListVoiceCalls200Response, Integer, Hash)>)

    ListVoiceCalls200Response data, response status code and response headers



1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
# File 'lib/zernio-sdk/api/voice_api.rb', line 1039

def list_voice_calls_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.list_voice_calls ...'
  end
  allowable_values = ["ringing", "answered", "ended", "failed"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  allowable_values = ["inbound", "outbound"]
  if @api_client.config.client_side_validation && opts[:'direction'] && !allowable_values.include?(opts[:'direction'])
    fail ArgumentError, "invalid value for \"direction\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling VoiceApi.list_voice_calls, must be smaller than or equal to 200.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling VoiceApi.list_voice_calls, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/voice/calls'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?
  query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListVoiceCalls200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.list_voice_calls",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#list_voice_calls\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#rotate_sip_trunk_credentials(id, opts = {}) ⇒ RotateSipTrunkCredentials200Response

Rotate a SIP trunk's password Mints a new digest password on the trunk. The old password stops working immediately, so update the destination platform right away.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1109
1110
1111
1112
# File 'lib/zernio-sdk/api/voice_api.rb', line 1109

def rotate_sip_trunk_credentials(id, opts = {})
  data, _status_code, _headers = rotate_sip_trunk_credentials_with_http_info(id, opts)
  data
end

#rotate_sip_trunk_credentials_with_http_info(id, opts = {}) ⇒ Array<(RotateSipTrunkCredentials200Response, Integer, Hash)>

Rotate a SIP trunk's password Mints a new digest password on the trunk. The old password stops working immediately, so update the destination platform right away.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
# File 'lib/zernio-sdk/api/voice_api.rb', line 1119

def rotate_sip_trunk_credentials_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.rotate_sip_trunk_credentials ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.rotate_sip_trunk_credentials"
  end
  # resource path
  local_var_path = '/v1/phone-numbers/sip-trunks/{id}/rotate-credentials'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RotateSipTrunkCredentials200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.rotate_sip_trunk_credentials",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#rotate_sip_trunk_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#transfer_voice_call(id, transfer_voice_call_request, opts = {}) ⇒ TransferVoiceCall200Response

Blind-transfer a live call Moves the call's current leg to a new destination (a phone number or a SIP endpoint). This is a BLIND transfer: control of the leg is handed off and the call ends normally when the transferred leg hangs up. The caller ID presented on the transfer leg is always your own number.

Parameters:

  • id (String)
  • transfer_voice_call_request (TransferVoiceCallRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1173
1174
1175
1176
# File 'lib/zernio-sdk/api/voice_api.rb', line 1173

def transfer_voice_call(id, transfer_voice_call_request, opts = {})
  data, _status_code, _headers = transfer_voice_call_with_http_info(id, transfer_voice_call_request, opts)
  data
end

#transfer_voice_call_with_http_info(id, transfer_voice_call_request, opts = {}) ⇒ Array<(TransferVoiceCall200Response, Integer, Hash)>

Blind-transfer a live call Moves the call's current leg to a new destination (a phone number or a SIP endpoint). This is a BLIND transfer: control of the leg is handed off and the call ends normally when the transferred leg hangs up. The caller ID presented on the transfer leg is always your own number.

Parameters:

  • id (String)
  • transfer_voice_call_request (TransferVoiceCallRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/zernio-sdk/api/voice_api.rb', line 1184

def transfer_voice_call_with_http_info(id, transfer_voice_call_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VoiceApi.transfer_voice_call ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling VoiceApi.transfer_voice_call"
  end
  # verify the required parameter 'transfer_voice_call_request' is set
  if @api_client.config.client_side_validation && transfer_voice_call_request.nil?
    fail ArgumentError, "Missing the required parameter 'transfer_voice_call_request' when calling VoiceApi.transfer_voice_call"
  end
  # resource path
  local_var_path = '/v1/voice/calls/{id}/transfer'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(transfer_voice_call_request)

  # return_type
  return_type = opts[:debug_return_type] || 'TransferVoiceCall200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"VoiceApi.transfer_voice_call",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VoiceApi#transfer_voice_call\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end