class Twilio::REST::Trunking::V1::TrunkContext
Public Class Methods
Initialize the TrunkContext
@param [Version] version Version
that contains the resource @param [String] sid The unique string that we created to identify the Trunk
resource to fetch.
@return [TrunkContext] TrunkContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 197 def initialize(version, sid) 198 super(version) 199 200 # Path Solution 201 @solution = {sid: sid, } 202 @uri = "/Trunks/#{@solution[:sid]}" 203 204 # Dependents 205 @origination_urls = nil 206 @credentials_lists = nil 207 @ip_access_control_lists = nil 208 @phone_numbers = nil 209 @recordings = nil 210 end
Public Instance Methods
Access the credentials_lists
@return [CredentialListList] @return [CredentialListContext] if sid was passed.
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 298 def credentials_lists(sid=:unset) 299 raise ArgumentError, 'sid cannot be nil' if sid.nil? 300 301 if sid != :unset 302 return CredentialListContext.new(@version, @solution[:sid], sid, ) 303 end 304 305 unless @credentials_lists 306 @credentials_lists = CredentialListList.new(@version, trunk_sid: @solution[:sid], ) 307 end 308 309 @credentials_lists 310 end
Delete the TrunkInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 224 def delete 225 @version.delete('DELETE', @uri) 226 end
Fetch the TrunkInstance
@return [TrunkInstance] Fetched TrunkInstance
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 215 def fetch 216 payload = @version.fetch('GET', @uri) 217 218 TrunkInstance.new(@version, payload, sid: @solution[:sid], ) 219 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 365 def inspect 366 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 367 "#<Twilio.Trunking.V1.TrunkContext #{context}>" 368 end
Access the ip_access_control_lists
@return [IpAccessControlListList] @return [IpAccessControlListContext] if sid was passed.
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 316 def ip_access_control_lists(sid=:unset) 317 raise ArgumentError, 'sid cannot be nil' if sid.nil? 318 319 if sid != :unset 320 return IpAccessControlListContext.new(@version, @solution[:sid], sid, ) 321 end 322 323 unless @ip_access_control_lists 324 @ip_access_control_lists = IpAccessControlListList.new(@version, trunk_sid: @solution[:sid], ) 325 end 326 327 @ip_access_control_lists 328 end
Access the origination_urls
@return [OriginationUrlList] @return [OriginationUrlContext] if sid was passed.
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 280 def origination_urls(sid=:unset) 281 raise ArgumentError, 'sid cannot be nil' if sid.nil? 282 283 if sid != :unset 284 return OriginationUrlContext.new(@version, @solution[:sid], sid, ) 285 end 286 287 unless @origination_urls 288 @origination_urls = OriginationUrlList.new(@version, trunk_sid: @solution[:sid], ) 289 end 290 291 @origination_urls 292 end
Access the phone_numbers
@return [PhoneNumberList] @return [PhoneNumberContext] if sid was passed.
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 334 def phone_numbers(sid=:unset) 335 raise ArgumentError, 'sid cannot be nil' if sid.nil? 336 337 if sid != :unset 338 return PhoneNumberContext.new(@version, @solution[:sid], sid, ) 339 end 340 341 unless @phone_numbers 342 @phone_numbers = PhoneNumberList.new(@version, trunk_sid: @solution[:sid], ) 343 end 344 345 @phone_numbers 346 end
Access the recordings @return [RecordingList] @return [RecordingContext]
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 352 def recordings 353 RecordingContext.new(@version, @solution[:sid], ) 354 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 358 def to_s 359 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 360 "#<Twilio.Trunking.V1.TrunkContext #{context}>" 361 end
Update the TrunkInstance
@param [String] friendly_name A descriptive string that you create to describe
the resource. It can be up to 64 characters long.
@param [String] domain_name 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}[https://www.twilio.com/docs/sip-trunking#termination] for more information.
@param [String] disaster_recovery_url 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}[https://www.twilio.com/docs/sip-trunking#disaster-recovery] for more information.
@param [String] disaster_recovery_method The HTTP
method we should use to call
the `disaster_recovery_url`. Can be: `GET` or `POST`.
@param [trunk.TransferSetting] transfer_mode The call transfer settings for the
trunk. Can be: `enable-all`, `sip-only` and `disable-all`. See {Transfer}[https://www.twilio.com/docs/sip-trunking/call-transfer] for more information.
@param [Boolean] secure 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}[https://www.twilio.com/docs/sip-trunking#securetrunking] for more information.
@param [Boolean] cnam_lookup_enabled 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}[https://www.twilio.com/docs/sip-trunking#CNAM] for more information.
@return [TrunkInstance] Updated TrunkInstance
# File lib/twilio-ruby/rest/trunking/v1/trunk.rb 260 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) 261 data = Twilio::Values.of({ 262 'FriendlyName' => friendly_name, 263 'DomainName' => domain_name, 264 'DisasterRecoveryUrl' => disaster_recovery_url, 265 'DisasterRecoveryMethod' => disaster_recovery_method, 266 'TransferMode' => transfer_mode, 267 'Secure' => secure, 268 'CnamLookupEnabled' => cnam_lookup_enabled, 269 }) 270 271 payload = @version.update('POST', @uri, data: data) 272 273 TrunkInstance.new(@version, payload, sid: @solution[:sid], ) 274 end