lib/trails/twilio/incoming.rb in trails-1.1.5 vs lib/trails/twilio/incoming.rb in trails-1.1.6
- old
+ new
@@ -21,38 +21,42 @@
protected
attr_reader :request
INCOMING_VARS = [
- # Always available:
- 'CallGuid', # A unique identifier for this call, generated by Twilio. It's 34 characters long, and always starts with the letters CA.
- 'Caller', # The phone number of the party that initiated the call. If the call is inbound, then it is the caller's caller-id. If the call is outbound, i.e., initiated by making a request to the REST Call API, then this is the phone number you specify as the caller-id.
- 'Called', # The phone number of the party that was called. If the call is inbound, then it's your application phone number. If the call is outbound, then it's the phone number you provided to call.
- 'AccountGuid', # Your Twilio account number which is the Twilio Account GUID for the call. It is 34 characters long, and always starts with the letters AC.
- 'CallStatus', # The status of the phone call. The value can be "in-progress", "completed", "busy", "failed" or "no-answer". For a call that was answered and is currently going on, the status would be "in-progress". For a call that couldn't be started because the called party was busy, didn't pick up, or the number dialed wasn't valid: "busy", "no-answer", or "failed" would be returned. If the call finished because the call ended or was hung up, the status would be "completed".
- 'CallerCity', # The city of the caller.
- 'CallerState', # The state or province of the caller.
- 'CallerZip', # The postal code of the caller.
- 'CallerCountry', # The country of the caller.
- 'CalledCity', # The city of the called party.
- 'CalledState', # The state or province of the called party.
- 'CalledZip', # The postal code of the called party.
- 'CalledCountry', # The country of the called party.
- # Gather:
- 'Digits', # The digits received from the caller
+ # Always available:
+ 'CallSid', # A unique identifier for this call, generated by Twilio.
+ 'AccountSid', # Your Twilio account id. It is 34 characters long, and always starts with the letters AC.
+ 'From', # The phone number of the party that initiated the call. Formatted with a '+' and country code e.g., +16175551212 (E.164 format). If the call is inbound, then it is the caller's caller ID. If the call is outbound, i.e., initiated via a request to the REST API, then this is the phone number you specify as the caller ID.
+ 'To', # The phone number of the called party. Formatted with a '+' and country code e.g., +16175551212 (E.164 format). If the call is inbound, then it's your Twilio phone number. If the call is outbound, then it's the phone number you provided to call.
+ 'CallStatus', # A descriptive status for the call. The value is one of queued, ringing, in-progress, completed, busy, failed or no-answer. See the CallStatus section below for more details.
+ 'ApiVersion', # The version of the Twilio API used to handle this call. For incoming calls, this is determined by the API version set on the called number. For outgoing calls, this is the API version used by the outgoing call's REST API request.
+ 'Direction', # Indicates the direction of the call. In most cases this will be inbound, but if you are using <Dial> it will be outbound-dial.
+ 'ForwardedFrom', # This parameter is set only when Twilio receives a forwarded call, but its value depends on the caller's carrier including information when forwarding. Not all carriers support passing this information.
+ 'FromCity', # The city of the caller.
+ 'FromState', # The state or province of the caller.
+ 'FromZip', # The postal code of the caller.
+ 'FromCountry', # The country of the caller.
+ 'ToCity', # The city of the called party.
+ 'ToState', # The state or province of the called party.
+ 'ToZip', # The postal code of the called party.
+ 'ToCountry', # The country of the called party.
- 'RecordingUrl', # The URL of the recorded audio file
- 'Duration', # The time duration of the recorded audio file
- 'Digits', # What (if any) key was pressed to end the recording
+ # Gather:
+ 'Digits', # The digits received from the caller
- # SMS:
- 'SmsMessageSid', # Message SID
- 'AccountSid', # Account ID
- 'From', #
- 'To', #
- 'Body', # 160 chars
+ 'RecordingUrl', # The URL of the recorded audio file
+ 'Duration', # The time duration of the recorded audio file
+ 'Digits', # What (if any) key was pressed to end the recording
- ].freeze
+ # SMS:
+ 'SmsMessageSid', # Message SID
+ 'AccountSid', # Account ID
+ 'From', #
+ 'To', #
+ 'Body', # 160 chars
+
+ ].freeze
public
INCOMING_VARS.uniq.each do |pname|
mname = pname.gsub( /[A-Z]/ ) { |s| "_#{s.downcase}" }.gsub( /^_/, '' )
# some extra debugging code here:
# ActionController::Base.logger.debug{ "defining method: #{mname} for param #{pname}" }