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/sip.rb,
lib/voiceml/models/calls.rb,
lib/voiceml/models/media.rb,
lib/voiceml/models/common.rb,
lib/voiceml/models/queues.rb,
lib/voiceml/models/siprec.rb,
lib/voiceml/resources/sip.rb,
lib/voiceml/models/streams.rb,
lib/voiceml/resources/base.rb,
lib/voiceml/models/accounts.rb,
lib/voiceml/models/messages.rb,
lib/voiceml/models/payments.rb,
lib/voiceml/models/voice_v1.rb,
lib/voiceml/resources/calls.rb,
lib/voiceml/models/routes_v2.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/resources/voice_v1.rb,
lib/voiceml/models/applications.rb,
lib/voiceml/resources/routes_v2.rb,
lib/voiceml/models/assistants_v1.rb,
lib/voiceml/models/notifications.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/models/conversations_v1.rb,
lib/voiceml/resources/assistants_v1.rb,
lib/voiceml/resources/notifications.rb,
lib/voiceml/models/outgoing_caller_ids.rb,
lib/voiceml/resources/conversations_v1.rb,
lib/voiceml/models/user_defined_messages.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 (https://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, V1Pageable Classes: Account, ApiError, Application, ApplicationList, ApplicationsResource, AssistantsV1Assistant, AssistantsV1AssistantFeedbacksScope, AssistantsV1AssistantKnowledgeScope, AssistantsV1AssistantList, AssistantsV1AssistantMessagesScope, AssistantsV1AssistantScope, AssistantsV1AssistantToolsScope, AssistantsV1AssistantWithToolsAndKnowledge, AssistantsV1AssistantsResource, AssistantsV1Feedback, AssistantsV1FeedbackList, AssistantsV1Knowledge, AssistantsV1KnowledgeChunk, AssistantsV1KnowledgeChunkList, AssistantsV1KnowledgeChunksScope, AssistantsV1KnowledgeList, AssistantsV1KnowledgeResource, AssistantsV1KnowledgeScope, AssistantsV1KnowledgeStatus, AssistantsV1KnowledgeStatusScope, AssistantsV1Message, AssistantsV1MessageList, AssistantsV1PoliciesResource, AssistantsV1Policy, AssistantsV1PolicyList, AssistantsV1Resource, AssistantsV1SendMessageResponse, AssistantsV1Session, AssistantsV1SessionList, AssistantsV1SessionMessagesScope, AssistantsV1SessionScope, AssistantsV1SessionsResource, AssistantsV1Tool, AssistantsV1ToolList, AssistantsV1ToolWithPolicies, AssistantsV1ToolsResource, AuthenticationError, BadRequestError, Balance, BaseResource, Call, CallList, CallPayment, CallTranscription, CallsResource, Client, Conference, ConferenceList, ConferencesResource, ConfigurationError, ConflictError, ConversationsV1ConfigAddress, ConversationsV1ConfigAddressList, ConversationsV1Configuration, ConversationsV1ConfigurationResource, ConversationsV1ConfigurationWebhook, ConversationsV1Conversation, ConversationsV1ConversationList, ConversationsV1ConversationMessage, ConversationsV1ConversationMessageList, ConversationsV1ConversationMessageReceipt, ConversationsV1ConversationMessageReceiptList, ConversationsV1ConversationParticipant, ConversationsV1ConversationParticipantList, ConversationsV1ConversationScopedWebhook, ConversationsV1ConversationScopedWebhookList, ConversationsV1ConversationWithParticipants, ConversationsV1ConversationWithParticipantsResource, ConversationsV1ConversationsResource, ConversationsV1Credential, ConversationsV1CredentialList, ConversationsV1CredentialsResource, ConversationsV1ParticipantConversation, ConversationsV1ParticipantConversationList, ConversationsV1ParticipantConversationsResource, ConversationsV1Resource, ConversationsV1Role, ConversationsV1RoleList, ConversationsV1RolesResource, ConversationsV1Service, ConversationsV1ServiceBinding, ConversationsV1ServiceBindingList, ConversationsV1ServiceConfiguration, ConversationsV1ServiceConversation, ConversationsV1ServiceConversationList, ConversationsV1ServiceConversationMessage, ConversationsV1ServiceConversationMessageList, ConversationsV1ServiceConversationMessageReceipt, ConversationsV1ServiceConversationMessageReceiptList, ConversationsV1ServiceConversationParticipant, ConversationsV1ServiceConversationParticipantList, ConversationsV1ServiceConversationScopedWebhook, ConversationsV1ServiceConversationScopedWebhookList, ConversationsV1ServiceConversationWithParticipants, ConversationsV1ServiceList, ConversationsV1ServiceNotification, ConversationsV1ServiceParticipantConversation, ConversationsV1ServiceParticipantConversationList, ConversationsV1ServiceRole, ConversationsV1ServiceRoleList, ConversationsV1ServiceScopeResource, ConversationsV1ServiceUser, ConversationsV1ServiceUserConversation, ConversationsV1ServiceUserConversationList, ConversationsV1ServiceUserList, ConversationsV1ServiceWebhookConfiguration, ConversationsV1ServicesResource, ConversationsV1User, ConversationsV1UserConversation, ConversationsV1UserConversationList, ConversationsV1UserList, ConversationsV1UsersResource, DiagnosticsResource, Error, ErrorBody, EventsList, GoneError, HealthFailure, HealthStatus, IncomingPhoneNumber, IncomingPhoneNumberList, IncomingPhoneNumbersResource, Media, MediaList, Message, MessageList, MessagesResource, NotFoundError, NotImplementedAPIError, Notification, NotificationsList, NotificationsResource, OutgoingCallerId, OutgoingCallerIdList, Participant, ParticipantList, PermissionDeniedError, Queue, QueueList, QueueMember, QueueMemberList, QueuesResource, RateLimitError, Recording, RecordingAudio, RecordingList, RecordingsResource, RoutesV2PhoneNumber, RoutesV2PhoneNumbersResource, RoutesV2Resource, RoutesV2SipDomain, RoutesV2SipDomainsResource, ServerError, SipAuthMappingList, SipCredential, SipCredentialList, SipCredentialListList, SipCredentialListMappingList, SipCredentialListPage, SipCredentialListsResource, SipDomain, SipDomainList, SipDomainMapping, SipDomainsResource, SipIpAccessControlList, SipIpAccessControlListList, SipIpAccessControlListMappingList, SipIpAccessControlListsResource, SipIpAddress, SipIpAddressList, SipResource, SiprecList, SiprecSession, Stream, StreamList, TranscriptionList, Transport, UserDefinedMessage, ValidationRequest, VoiceV1ByocTrunk, VoiceV1ByocTrunkList, VoiceV1ByocTrunksResource, VoiceV1ConnectionPoliciesResource, VoiceV1ConnectionPolicy, VoiceV1ConnectionPolicyList, VoiceV1ConnectionPolicyTarget, VoiceV1ConnectionPolicyTargetList, VoiceV1DialingPermissionsResource, VoiceV1DialingPermissionsSettings, VoiceV1IpRecord, VoiceV1IpRecordList, VoiceV1IpRecordsResource, VoiceV1Resource, VoiceV1SourceIpMapping, VoiceV1SourceIpMappingList, VoiceV1SourceIpMappingsResource

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.9.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