Class: Twilio::REST::Voice::V1::ByocTrunkInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ByocTrunkInstance

Initialize the ByocTrunkInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this ByocTrunk resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



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
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 309

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'sid' => payload['sid'],
        'friendly_name' => payload['friendly_name'],
        'voice_url' => payload['voice_url'],
        'voice_method' => payload['voice_method'],
        'voice_fallback_url' => payload['voice_fallback_url'],
        'voice_fallback_method' => payload['voice_fallback_method'],
        'status_callback_url' => payload['status_callback_url'],
        'status_callback_method' => payload['status_callback_method'],
        'cnam_lookup_enabled' => payload['cnam_lookup_enabled'],
        'connection_policy_sid' => payload['connection_policy_sid'],
        'from_domain_sid' => payload['from_domain_sid'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the BYOC Trunk resource.

Returns:



349
350
351
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 349

def 
    @properties['account_sid']
end

#cnam_lookup_enabledBoolean

Returns Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](www.twilio.com/docs/sip-trunking#CNAM) for more information.

Returns:

  • (Boolean)

    Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](www.twilio.com/docs/sip-trunking#CNAM) for more information.



403
404
405
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 403

def cnam_lookup_enabled
    @properties['cnam_lookup_enabled']
end

#connection_policy_sidString

Returns The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.

Returns:

  • (String)

    The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.



409
410
411
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 409

def connection_policy_sid
    @properties['connection_policy_sid']
end

#contextByocTrunkContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



340
341
342
343
344
345
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 340

def context
    unless @instance_context
        @instance_context = ByocTrunkContext.new(@version , @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



421
422
423
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 421

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



427
428
429
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 427

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ByocTrunkInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



440
441
442
443
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 440

def delete

    context.delete
end

#fetchByocTrunkInstance

Fetch the ByocTrunkInstance

Returns:



448
449
450
451
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 448

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource.



361
362
363
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 361

def friendly_name
    @properties['friendly_name']
end

#from_domain_sidString

Returns The SID of the SIP Domain that should be used in the ‘From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a [SIP Domain](www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".

Returns:

  • (String)

    The SID of the SIP Domain that should be used in the ‘From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a [SIP Domain](www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".



415
416
417
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 415

def from_domain_sid
    @properties['from_domain_sid']
end

#inspectObject

Provide a detailed, user friendly representation



502
503
504
505
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 502

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Voice.V1.ByocTrunkInstance #{values}>"
end

#sidString

Returns The unique string that that we created to identify the BYOC Trunk resource.

Returns:

  • (String)

    The unique string that that we created to identify the BYOC Trunk resource.



355
356
357
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 355

def sid
    @properties['sid']
end

#status_callback_methodString

Returns The HTTP method we use to call ‘status_callback_url`. Either `GET` or `POST`.

Returns:

  • (String)

    The HTTP method we use to call ‘status_callback_url`. Either `GET` or `POST`.



397
398
399
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 397

def status_callback_method
    @properties['status_callback_method']
end

#status_callback_urlString

Returns The URL that we call to pass status parameters (such as call ended) to your application.

Returns:

  • (String)

    The URL that we call to pass status parameters (such as call ended) to your application.



391
392
393
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 391

def status_callback_url
    @properties['status_callback_url']
end

#to_sObject

Provide a user friendly representation



495
496
497
498
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 495

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Voice.V1.ByocTrunkInstance #{values}>"
end

#update(friendly_name: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, cnam_lookup_enabled: :unset, connection_policy_sid: :unset, from_domain_sid: :unset) ⇒ ByocTrunkInstance

Update the ByocTrunkInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.

  • voice_url (String) (defaults to: :unset)

    The URL we should call when the BYOC Trunk receives a call.

  • voice_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘voice_url`

  • voice_fallback_url (String) (defaults to: :unset)

    The URL that we should call when an error occurs while retrieving or executing the TwiML requested by ‘voice_url`.

  • voice_fallback_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘voice_fallback_url`. Can be: `GET` or `POST`.

  • status_callback_url (String) (defaults to: :unset)

    The URL that we should call to pass status parameters (such as call ended) to your application.

  • status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘status_callback_url`. Can be: `GET` or `POST`.

  • cnam_lookup_enabled (Boolean) (defaults to: :unset)

    Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](www.twilio.com/docs/sip-trunking#CNAM) for more information.

  • connection_policy_sid (String) (defaults to: :unset)

    The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.

  • from_domain_sid (String) (defaults to: :unset)

    The SID of the SIP Domain that should be used in the ‘From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\".

Returns:



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 466

def update(
    friendly_name: :unset, 
    voice_url: :unset, 
    voice_method: :unset, 
    voice_fallback_url: :unset, 
    voice_fallback_method: :unset, 
    status_callback_url: :unset, 
    status_callback_method: :unset, 
    cnam_lookup_enabled: :unset, 
    connection_policy_sid: :unset, 
    from_domain_sid: :unset
)

    context.update(
        friendly_name: friendly_name, 
        voice_url: voice_url, 
        voice_method: voice_method, 
        voice_fallback_url: voice_fallback_url, 
        voice_fallback_method: voice_fallback_method, 
        status_callback_url: status_callback_url, 
        status_callback_method: status_callback_method, 
        cnam_lookup_enabled: cnam_lookup_enabled, 
        connection_policy_sid: connection_policy_sid, 
        from_domain_sid: from_domain_sid, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



433
434
435
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 433

def url
    @properties['url']
end

#voice_fallback_methodString

Returns The HTTP method we use to call ‘voice_fallback_url`. Can be: `GET` or `POST`.

Returns:

  • (String)

    The HTTP method we use to call ‘voice_fallback_url`. Can be: `GET` or `POST`.



385
386
387
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 385

def voice_fallback_method
    @properties['voice_fallback_method']
end

#voice_fallback_urlString

Returns The URL that we call when an error occurs while retrieving or executing the TwiML requested from ‘voice_url`.

Returns:

  • (String)

    The URL that we call when an error occurs while retrieving or executing the TwiML requested from ‘voice_url`.



379
380
381
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 379

def voice_fallback_url
    @properties['voice_fallback_url']
end

#voice_methodString

Returns The HTTP method we use to call ‘voice_url`. Can be: `GET` or `POST`.

Returns:

  • (String)

    The HTTP method we use to call ‘voice_url`. Can be: `GET` or `POST`.



373
374
375
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 373

def voice_method
    @properties['voice_method']
end

#voice_urlString

Returns The URL we call using the ‘voice_method` when the BYOC Trunk receives a call.

Returns:

  • (String)

    The URL we call using the ‘voice_method` when the BYOC Trunk receives a call.



367
368
369
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 367

def voice_url
    @properties['voice_url']
end