class Twilio::REST::Api::V2010::AccountContext::CallInstance
Public Class Methods
Initialize the CallInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] account_sid
The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that created this Call resource.
@param [String] sid The SID of the Call resource to fetch. @return [CallInstance] CallInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 626 def initialize(version, payload, account_sid: nil, sid: nil) 627 super(version) 628 629 # Marshaled Properties 630 @properties = { 631 'sid' => payload['sid'], 632 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 633 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 634 'parent_call_sid' => payload['parent_call_sid'], 635 'account_sid' => payload['account_sid'], 636 'to' => payload['to'], 637 'to_formatted' => payload['to_formatted'], 638 'from' => payload['from'], 639 'from_formatted' => payload['from_formatted'], 640 'phone_number_sid' => payload['phone_number_sid'], 641 'status' => payload['status'], 642 'start_time' => Twilio.deserialize_rfc2822(payload['start_time']), 643 'end_time' => Twilio.deserialize_rfc2822(payload['end_time']), 644 'duration' => payload['duration'], 645 'price' => payload['price'], 646 'price_unit' => payload['price_unit'], 647 'direction' => payload['direction'], 648 'answered_by' => payload['answered_by'], 649 'annotation' => payload['annotation'], 650 'api_version' => payload['api_version'], 651 'forwarded_from' => payload['forwarded_from'], 652 'group_sid' => payload['group_sid'], 653 'caller_name' => payload['caller_name'], 654 'queue_time' => payload['queue_time'], 655 'trunk_sid' => payload['trunk_sid'], 656 'uri' => payload['uri'], 657 'subresource_uris' => payload['subresource_uris'], 658 } 659 660 # Context 661 @instance_context = nil 662 @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'], } 663 end
Public Instance Methods
@return [String] The SID of the Account that created this resource
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 702 def account_sid 703 @properties['account_sid'] 704 end
@return [String] The annotation provided for the call
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 786 def annotation 787 @properties['annotation'] 788 end
@return [String] Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 780 def answered_by 781 @properties['answered_by'] 782 end
@return [String] The API Version
used to create the call
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 792 def api_version 793 @properties['api_version'] 794 end
@return [String] The caller's name if this call was an incoming call to a phone number with caller ID Lookup enabled. Otherwise, empty.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 810 def caller_name 811 @properties['caller_name'] 812 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [CallContext] CallContext
for this CallInstance
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 669 def context 670 unless @instance_context 671 @instance_context = CallContext.new(@version, @params['account_sid'], @params['sid'], ) 672 end 673 @instance_context 674 end
@return [Time] The RFC 2822 date and time in GMT that this resource was created
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 684 def date_created 685 @properties['date_created'] 686 end
@return [Time] The RFC 2822 date and time in GMT that this resource was last updated
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 690 def date_updated 691 @properties['date_updated'] 692 end
Delete the CallInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 841 def delete 842 context.delete 843 end
@return [String] A string describing the direction of the call. `inbound` for inbound calls, `outbound-api` for calls initiated via the REST
API or `outbound-dial` for calls initiated by a `Dial` verb.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 774 def direction 775 @properties['direction'] 776 end
@return [String] The length of the call in seconds.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 756 def duration 757 @properties['duration'] 758 end
@return [Time] The end time of the call. Null if the call did not complete successfully.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 750 def end_time 751 @properties['end_time'] 752 end
Access the events @return [events] events
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 924 def events 925 context.events 926 end
Access the feedback @return [feedback] feedback
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 917 def feedback 918 context.feedback 919 end
Fetch the CallInstance
@return [CallInstance] Fetched CallInstance
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 848 def fetch 849 context.fetch 850 end
@return [String] The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 798 def forwarded_from 799 @properties['forwarded_from'] 800 end
@return [String] The phone number, SIP address or Client
identifier that made this call. Phone numbers are in E.164 format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client
identifiers are formatted `client:name`.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 720 def from 721 @properties['from'] 722 end
@return [String] The calling phone number, SIP address, or Client
identifier formatted for display.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 726 def from_formatted 727 @properties['from_formatted'] 728 end
@return [String] The Group SID associated with this call. If no Group is associated with the call, the field is empty.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 804 def group_sid 805 @properties['group_sid'] 806 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 944 def inspect 945 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 946 "<Twilio.Api.V2010.CallInstance #{values}>" 947 end
Access the notifications @return [notifications] notifications
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 910 def notifications 911 context.notifications 912 end
@return [String] The SID that identifies the call that created this leg.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 696 def parent_call_sid 697 @properties['parent_call_sid'] 698 end
Access the payments @return [payments] payments
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 931 def payments 932 context.payments 933 end
@return [String] If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 732 def phone_number_sid 733 @properties['phone_number_sid'] 734 end
@return [String] The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 762 def price 763 @properties['price'] 764 end
@return [String] The currency in which `Price` is measured.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 768 def price_unit 769 @properties['price_unit'] 770 end
@return [String] The wait time in milliseconds before the call is placed.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 816 def queue_time 817 @properties['queue_time'] 818 end
Access the recordings @return [recordings] recordings
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 903 def recordings 904 context.recordings 905 end
@return [String] The unique string that identifies this resource
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 678 def sid 679 @properties['sid'] 680 end
@return [Time] The start time of the call. Null if the call has not yet been dialed.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 744 def start_time 745 @properties['start_time'] 746 end
@return [call.Status] The status of this call.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 738 def status 739 @properties['status'] 740 end
@return [String] A list of related subresources identified by their relative URIs
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 834 def subresource_uris 835 @properties['subresource_uris'] 836 end
@return [String] The phone number, SIP address or Client
identifier that received this call. Phone numbers are in E.164 format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client
identifiers are formatted `client:name`.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 708 def to 709 @properties['to'] 710 end
@return [String] The phone number, SIP address or Client
identifier that received this call. Formatted for display.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 714 def to_formatted 715 @properties['to_formatted'] 716 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 937 def to_s 938 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 939 "<Twilio.Api.V2010.CallInstance #{values}>" 940 end
@return [String] The (optional) unique identifier of the trunk resource that was used for this call.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 822 def trunk_sid 823 @properties['trunk_sid'] 824 end
Update the CallInstance
@param [String] url The absolute URL that returns the TwiML
instructions for the
call. We will call this URL using the `method` when the call connects. For more information, see the {Url Parameter}[https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter] section in {Making Calls}[https://www.twilio.com/docs/voice/make-calls].
@param [String] method The HTTP
method we should use when calling the `url`. Can
be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
@param [call.UpdateStatus] status The new status of the resource. Can be:
`canceled` or `completed`. Specifying `canceled` will attempt to hang up calls that are queued or ringing; however, it will not affect calls already in progress. Specifying `completed` will attempt to hang up a call even if it's already in progress.
@param [String] fallback_url The URL that we call using the `fallback_method` if
an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored.
@param [String] fallback_method The HTTP
method that we should use to request
the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
@param [String] status_callback The URL we should call using the
`status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted).
@param [String] status_callback_method The HTTP
method we should use when
requesting the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
@param [String] twiml TwiML
instructions for the call Twilio
will use without
fetching Twiml from url. Twiml and url parameters are mutually exclusive
@param [String] time_limit The maximum duration of the call in seconds.
Constraints depend on account and configuration.
@return [CallInstance] Updated CallInstance
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 886 def update(url: :unset, method: :unset, status: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_method: :unset, twiml: :unset, time_limit: :unset) 887 context.update( 888 url: url, 889 method: method, 890 status: status, 891 fallback_url: fallback_url, 892 fallback_method: fallback_method, 893 status_callback: status_callback, 894 status_callback_method: status_callback_method, 895 twiml: twiml, 896 time_limit: time_limit, 897 ) 898 end
@return [String] The URI of this resource, relative to `api.twilio.com`
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 828 def uri 829 @properties['uri'] 830 end