Module: VoiceML

Defined in:
lib/voiceml.rb,
lib/voiceml/client.rb,
lib/voiceml/errors.rb,
lib/voiceml/version.rb,
lib/voiceml/transport.rb,
lib/voiceml/models/calls.rb,
lib/voiceml/models/common.rb,
lib/voiceml/models/queues.rb,
lib/voiceml/models/siprec.rb,
lib/voiceml/models/streams.rb,
lib/voiceml/resources/base.rb,
lib/voiceml/models/messages.rb,
lib/voiceml/models/payments.rb,
lib/voiceml/resources/calls.rb,
lib/voiceml/resources/queues.rb,
lib/voiceml/models/recordings.rb,
lib/voiceml/models/conferences.rb,
lib/voiceml/models/diagnostics.rb,
lib/voiceml/resources/messages.rb,
lib/voiceml/models/applications.rb,
lib/voiceml/resources/recordings.rb,
lib/voiceml/models/transcriptions.rb,
lib/voiceml/resources/conferences.rb,
lib/voiceml/resources/diagnostics.rb,
lib/voiceml/resources/applications.rb,
lib/voiceml/resources/notifications.rb,
lib/voiceml/models/incoming_phone_numbers.rb,
lib/voiceml/resources/incoming_phone_numbers.rb

Overview

Official Ruby SDK for the VoiceML REST API.

VoiceML is VoiceTel’s outbound voice + AMD service with a Twilio-compatible REST surface (‘voiceml.voicetel.com`). The wire shape, auth model, error codes, and pagination envelope all match Twilio’s documented behaviour — so existing Twilio client patterns map across.

Examples:

require 'voiceml'

client = VoiceML::Client.new(account_sid: 'AC...', api_key: '...')
call = client.calls.create(
  to: '+18005551234',
  from: '+18005550000',
  url: 'https://example.com/twiml',
  machine_detection: 'DetectMessageEnd'
)
puts call.sid, call.status

Defined Under Namespace

Modules: Pageable, PaymentBankAccountType, PaymentCapture, PaymentInput, PaymentMethod, PaymentSessionStatus, PaymentTokenType Classes: ApiError, Application, ApplicationList, ApplicationsResource, AuthenticationError, BadRequestError, BaseResource, Call, CallList, CallPayment, CallTranscription, CallsResource, Client, Conference, ConferenceList, ConferencesResource, ConfigurationError, ConflictError, DiagnosticsResource, Error, ErrorBody, EventsList, GoneError, HealthFailure, HealthStatus, IncomingPhoneNumber, IncomingPhoneNumberList, IncomingPhoneNumbersResource, Message, MessageList, MessagesResource, NotFoundError, NotImplementedAPIError, NotificationsList, NotificationsResource, Participant, ParticipantList, PermissionDeniedError, Queue, QueueList, QueueMember, QueueMemberList, QueuesResource, RateLimitError, Recording, RecordingAudio, RecordingList, RecordingsResource, ServerError, SiprecList, SiprecSession, Stream, StreamList, TranscriptionList, Transport

Constant Summary collapse

ERROR_CLASSES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  400 => BadRequestError,
  401 => AuthenticationError,
  403 => PermissionDeniedError,
  404 => NotFoundError,
  409 => ConflictError,
  410 => GoneError,
  429 => RateLimitError,
  501 => NotImplementedAPIError
}.freeze
VERSION =
'0.7.1.1'

Class Method Summary collapse

Class Method Details

.error_from_response(status_code, message, code: nil, body: nil, more_info: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Map an HTTP status to the most specific ‘ApiError` subclass.



69
70
71
72
73
74
# File 'lib/voiceml/errors.rb', line 69

def self.error_from_response(status_code, message, code: nil, body: nil, more_info: nil)
  klass = ERROR_CLASSES[status_code]
  klass ||= ServerError if status_code >= 500 && status_code < 600
  klass ||= ApiError
  klass.new(message, status_code: status_code, code: code, body: body, more_info: more_info)
end