Class: Twilio::REST::Api::V2010::AccountContext::SipList::DomainContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.rb

Defined Under Namespace

Classes: AuthTypesInstance, AuthTypesList, AuthTypesListResponse, AuthTypesPage, AuthTypesPageMetadata, CredentialListMappingContext, CredentialListMappingInstance, CredentialListMappingInstanceMetadata, CredentialListMappingList, CredentialListMappingListResponse, CredentialListMappingPage, CredentialListMappingPageMetadata, IpAccessControlListMappingContext, IpAccessControlListMappingInstance, IpAccessControlListMappingInstanceMetadata, IpAccessControlListMappingList, IpAccessControlListMappingListResponse, IpAccessControlListMappingPage, IpAccessControlListMappingPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ DomainContext

Initialize the DomainContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the SipDomain resource to update.

  • sid (String)

    The Twilio-provided string that uniquely identifies the SipDomain resource to update.



301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 301

def initialize(version, , sid)
    super(version)
    

    # Path Solution
    @solution = { account_sid: , sid: sid,  }
    @uri = "/Accounts/#{@solution[:account_sid]}/SIP/Domains/#{@solution[:sid]}.json"

    # Dependents
    @auth = nil
    @ip_access_control_list_mappings = nil
    @credential_list_mappings = nil
end

Instance Method Details

#authAuthTypesList, AuthTypesContext

Access the auth

Returns:



528
529
530
531
532
533
534
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 528

def auth
  unless @auth
    @auth = AuthTypesList.new(
            @version, account_sid: @solution[:account_sid], domain_sid: @solution[:sid], )
  end
  @auth
end

#credential_list_mappings(sid = :unset) ⇒ CredentialListMappingList, CredentialListMappingContext

Access the credential_list_mappings

Returns:

Raises:

  • (ArgumentError)


558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 558

def credential_list_mappings(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return CredentialListMappingContext.new(@version, @solution[:account_sid], @solution[:sid],sid )
    end

    unless @credential_list_mappings
        @credential_list_mappings = CredentialListMappingList.new(
            @version, account_sid: @solution[:account_sid], domain_sid: @solution[:sid], )
    end

 @credential_list_mappings
end

#deleteBoolean

Delete the DomainInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



317
318
319
320
321
322
323
324
325
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 317

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the DomainInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 330

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      domain_instance = DomainInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      DomainInstanceMetadata.new(@version, domain_instance, response.headers, response.status_code)
end

#fetchDomainInstance

Fetch the DomainInstance

Returns:



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 349

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    DomainInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
end

#fetch_with_metadataDomainInstance

Fetch the DomainInstanceMetadata

Returns:



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 369

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    domain_instance = DomainInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
    DomainInstanceMetadata.new(
        @version,
        domain_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



583
584
585
586
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 583

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.DomainContext #{context}>"
end

#ip_access_control_list_mappings(sid = :unset) ⇒ IpAccessControlListMappingList, IpAccessControlListMappingContext

Access the ip_access_control_list_mappings

Returns:

Raises:

  • (ArgumentError)


539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 539

def ip_access_control_list_mappings(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return IpAccessControlListMappingContext.new(@version, @solution[:account_sid], @solution[:sid],sid )
    end

    unless @ip_access_control_list_mappings
        @ip_access_control_list_mappings = IpAccessControlListMappingList.new(
            @version, account_sid: @solution[:account_sid], domain_sid: @solution[:sid], )
    end

 @ip_access_control_list_mappings
end

#to_sObject

Provide a user friendly representation



576
577
578
579
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 576

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.DomainContext #{context}>"
end

#update(friendly_name: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_status_callback_method: :unset, voice_status_callback_url: :unset, voice_url: :unset, sip_registration: :unset, domain_name: :unset, emergency_calling_enabled: :unset, secure: :unset, byoc_trunk_sid: :unset, emergency_caller_sid: :unset) ⇒ DomainInstance

Update the DomainInstance

Parameters:

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

    A descriptive string that you created to describe the resource. It can be up to 64 characters long.

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

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

  • 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_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘voice_url`

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

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

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

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

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

    The URL we should call when the domain receives a call.

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

    Whether to allow SIP Endpoints to register with the domain to receive calls. Can be ‘true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not.

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

    The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \"-\" and must end with ‘sip.twilio.com`.

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

    Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses.

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

    Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain.

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

    The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with.

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

    Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call.

Returns:



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 408

def update(
  friendly_name: :unset, 
  voice_fallback_method: :unset, 
  voice_fallback_url: :unset, 
  voice_method: :unset, 
  voice_status_callback_method: :unset, 
  voice_status_callback_url: :unset, 
  voice_url: :unset, 
  sip_registration: :unset, 
  domain_name: :unset, 
  emergency_calling_enabled: :unset, 
  secure: :unset, 
  byoc_trunk_sid: :unset, 
  emergency_caller_sid: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'VoiceFallbackMethod' => voice_fallback_method,
        'VoiceFallbackUrl' => voice_fallback_url,
        'VoiceMethod' => voice_method,
        'VoiceStatusCallbackMethod' => voice_status_callback_method,
        'VoiceStatusCallbackUrl' => voice_status_callback_url,
        'VoiceUrl' => voice_url,
        'SipRegistration' => sip_registration,
        'DomainName' => domain_name,
        'EmergencyCallingEnabled' => emergency_calling_enabled,
        'Secure' => secure,
        'ByocTrunkSid' => byoc_trunk_sid,
        'EmergencyCallerSid' => emergency_caller_sid,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    DomainInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
end

#update_with_metadata(friendly_name: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_status_callback_method: :unset, voice_status_callback_url: :unset, voice_url: :unset, sip_registration: :unset, domain_name: :unset, emergency_calling_enabled: :unset, secure: :unset, byoc_trunk_sid: :unset, emergency_caller_sid: :unset) ⇒ DomainInstance

Update the DomainInstanceMetadata

Parameters:

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

    A descriptive string that you created to describe the resource. It can be up to 64 characters long.

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

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

  • 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_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘voice_url`

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

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

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

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

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

    The URL we should call when the domain receives a call.

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

    Whether to allow SIP Endpoints to register with the domain to receive calls. Can be ‘true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not.

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

    The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \"-\" and must end with ‘sip.twilio.com`.

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

    Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses.

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

    Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain.

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

    The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with.

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

    Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call.

Returns:



471
472
473
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
511
512
513
514
515
516
517
518
519
520
521
522
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 471

def (
  friendly_name: :unset, 
  voice_fallback_method: :unset, 
  voice_fallback_url: :unset, 
  voice_method: :unset, 
  voice_status_callback_method: :unset, 
  voice_status_callback_url: :unset, 
  voice_url: :unset, 
  sip_registration: :unset, 
  domain_name: :unset, 
  emergency_calling_enabled: :unset, 
  secure: :unset, 
  byoc_trunk_sid: :unset, 
  emergency_caller_sid: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'VoiceFallbackMethod' => voice_fallback_method,
        'VoiceFallbackUrl' => voice_fallback_url,
        'VoiceMethod' => voice_method,
        'VoiceStatusCallbackMethod' => voice_status_callback_method,
        'VoiceStatusCallbackUrl' => voice_status_callback_url,
        'VoiceUrl' => voice_url,
        'SipRegistration' => sip_registration,
        'DomainName' => domain_name,
        'EmergencyCallingEnabled' => emergency_calling_enabled,
        'Secure' => secure,
        'ByocTrunkSid' => byoc_trunk_sid,
        'EmergencyCallerSid' => emergency_caller_sid,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    domain_instance = DomainInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
    DomainInstanceMetadata.new(
        @version,
        domain_instance,
        response.headers,
        response.status_code
    )
end