Class: Twilio::REST::Trunking::V1::TrunkInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the TrunkInstance

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 Trunk resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



696
697
698
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
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 696

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'domain_name' => payload['domain_name'],
        'disaster_recovery_method' => payload['disaster_recovery_method'],
        'disaster_recovery_url' => payload['disaster_recovery_url'],
        'friendly_name' => payload['friendly_name'],
        'secure' => payload['secure'],
        'recording' => payload['recording'],
        'transfer_mode' => payload['transfer_mode'],
        'transfer_caller_id' => payload['transfer_caller_id'],
        'cnam_lookup_enabled' => payload['cnam_lookup_enabled'],
        'auth_type' => payload['auth_type'],
        'symmetric_rtp_enabled' => payload['symmetric_rtp_enabled'],
        'auth_type_set' => payload['auth_type_set'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'sid' => payload['sid'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # 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 Trunk resource.

Returns:



740
741
742
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 740

def 
    @properties['account_sid']
end

#auth_typeString

Returns The types of authentication mapped to the domain. Can be: IP_ACL and CREDENTIAL_LIST. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic.

Returns:

  • (String)

    The types of authentication mapped to the domain. Can be: IP_ACL and CREDENTIAL_LIST. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic.



800
801
802
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 800

def auth_type
    @properties['auth_type']
end

#auth_type_setArray<String>

Returns Reserved.

Returns:

  • (Array<String>)

    Reserved.



812
813
814
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 812

def auth_type_set
    @properties['auth_type_set']
end

#cnam_lookup_enabledBoolean

Returns Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP 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 SIP 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.



794
795
796
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 794

def cnam_lookup_enabled
    @properties['cnam_lookup_enabled']
end

#contextTrunkContext

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

Returns:



731
732
733
734
735
736
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 731

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

#credentials_listscredentials_lists

Access the credentials_lists

Returns:



906
907
908
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 906

def credentials_lists
    context.credentials_lists
end

#date_createdTime

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

Returns:



818
819
820
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 818

def date_created
    @properties['date_created']
end

#date_updatedTime

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

Returns:



824
825
826
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 824

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the TrunkInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



849
850
851
852
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 849

def delete

    context.delete
end

#disaster_recovery_methodString

Returns The HTTP method we use to call the disaster_recovery_url. Can be: GET or POST.

Returns:

  • (String)

    The HTTP method we use to call the disaster_recovery_url. Can be: GET or POST.



752
753
754
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 752

def disaster_recovery_method
    @properties['disaster_recovery_method']
end

#disaster_recovery_urlString

Returns The URL we call using the disaster_recovery_method if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](www.twilio.com/docs/sip-trunking#disaster-recovery) for more information.

Returns:

  • (String)

    The URL we call using the disaster_recovery_method if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](www.twilio.com/docs/sip-trunking#disaster-recovery) for more information.



758
759
760
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 758

def disaster_recovery_url
    @properties['disaster_recovery_url']
end

#domain_nameString

Returns 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 pstn.twilio.com. See [Termination Settings](www.twilio.com/docs/sip-trunking#termination) for more information.

Returns:

  • (String)

    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 pstn.twilio.com. See [Termination Settings](www.twilio.com/docs/sip-trunking#termination) for more information.



746
747
748
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 746

def domain_name
    @properties['domain_name']
end

#fetchTrunkInstance

Fetch the TrunkInstance

Returns:



857
858
859
860
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 857

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.



764
765
766
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 764

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



940
941
942
943
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 940

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

#ip_access_control_listsip_access_control_lists

Access the ip_access_control_lists

Returns:



913
914
915
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 913

def ip_access_control_lists
    context.ip_access_control_lists
end

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



842
843
844
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 842

def links
    @properties['links']
end

#origination_urlsorigination_urls

Access the origination_urls

Returns:



927
928
929
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 927

def origination_urls
    context.origination_urls
end

#phone_numbersphone_numbers

Access the phone_numbers

Returns:



920
921
922
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 920

def phone_numbers
    context.phone_numbers
end

#recordingHash

Returns The recording settings for the trunk. Can be: do-not-record, record-from-ringing, record-from-answer. If set to record-from-ringing or record-from-answer, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g.‘/Trunks//Recording -XPOST -d’Mode=record-from-answer’‘. See [Recording](www.twilio.com/docs/sip-trunking#recording) for more information.

Returns:

  • (Hash)

    The recording settings for the trunk. Can be: do-not-record, record-from-ringing, record-from-answer. If set to record-from-ringing or record-from-answer, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g.‘/Trunks//Recording -XPOST -d’Mode=record-from-answer’‘. See [Recording](www.twilio.com/docs/sip-trunking#recording) for more information.



776
777
778
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 776

def recording
    @properties['recording']
end

#recordingsrecordings

Access the recordings

Returns:



899
900
901
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 899

def recordings
    context.recordings
end

#secureBoolean

Returns Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](www.twilio.com/docs/sip-trunking#securetrunking) for more information.

Returns:

  • (Boolean)

    Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](www.twilio.com/docs/sip-trunking#securetrunking) for more information.



770
771
772
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 770

def secure
    @properties['secure']
end

#sidString

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

Returns:

  • (String)

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



830
831
832
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 830

def sid
    @properties['sid']
end

#symmetric_rtp_enabledBoolean

Returns Whether Symmetric RTP is enabled for the trunk. When Symmetric RTP is disabled, Twilio will send RTP to the destination negotiated in the SDP. Disabling Symmetric RTP is considered to be more secure and therefore recommended. See [Symmetric RTP](www.twilio.com/docs/sip-trunking#symmetric-rtp) for more information.

Returns:

  • (Boolean)

    Whether Symmetric RTP is enabled for the trunk. When Symmetric RTP is disabled, Twilio will send RTP to the destination negotiated in the SDP. Disabling Symmetric RTP is considered to be more secure and therefore recommended. See [Symmetric RTP](www.twilio.com/docs/sip-trunking#symmetric-rtp) for more information.



806
807
808
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 806

def symmetric_rtp_enabled
    @properties['symmetric_rtp_enabled']
end

#to_sObject

Provide a user friendly representation



933
934
935
936
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 933

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

#transfer_caller_idTransferCallerId

Returns:

  • (TransferCallerId)


788
789
790
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 788

def transfer_caller_id
    @properties['transfer_caller_id']
end

#transfer_modeTransferSetting

Returns:

  • (TransferSetting)


782
783
784
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 782

def transfer_mode
    @properties['transfer_mode']
end

#update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, transfer_mode: :unset, secure: :unset, cnam_lookup_enabled: :unset, transfer_caller_id: :unset) ⇒ TrunkInstance

Update the TrunkInstance

Parameters:

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

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

  • 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 pstn.twilio.com. See [Termination Settings](www.twilio.com/docs/sip-trunking#termination) for more information.

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

    The URL we should call using the disaster_recovery_method if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](www.twilio.com/docs/sip-trunking#disaster-recovery) for more information.

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

    The HTTP method we should use to call the disaster_recovery_url. Can be: GET or POST.

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

    Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](www.twilio.com/docs/sip-trunking#securetrunking) for more information.

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

    Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP 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.

  • transfer_caller_id (TransferCallerId) (defaults to: :unset)

Returns:



873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 873

def update(
    friendly_name: :unset, 
    domain_name: :unset, 
    disaster_recovery_url: :unset, 
    disaster_recovery_method: :unset, 
    transfer_mode: :unset, 
    secure: :unset, 
    cnam_lookup_enabled: :unset, 
    transfer_caller_id: :unset
)

    context.update(
        friendly_name: friendly_name, 
        domain_name: domain_name, 
        disaster_recovery_url: disaster_recovery_url, 
        disaster_recovery_method: disaster_recovery_method, 
        transfer_mode: transfer_mode, 
        secure: secure, 
        cnam_lookup_enabled: cnam_lookup_enabled, 
        transfer_caller_id: transfer_caller_id, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



836
837
838
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 836

def url
    @properties['url']
end