Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,13 @@ lib/bandwidth-sdk/models/recording_transcription_metadata.rb
lib/bandwidth-sdk/models/recording_transcriptions.rb
lib/bandwidth-sdk/models/redirect_callback.rb
lib/bandwidth-sdk/models/redirect_method_enum.rb
lib/bandwidth-sdk/models/refer.rb
lib/bandwidth-sdk/models/refer_call_status_enum.rb
lib/bandwidth-sdk/models/refer_complete_callback.rb
lib/bandwidth-sdk/models/refer_complete_method_enum.rb
lib/bandwidth-sdk/models/sip_connection_metadata.rb
lib/bandwidth-sdk/models/sip_credentials.rb
lib/bandwidth-sdk/models/sip_uri.rb
lib/bandwidth-sdk/models/sms_message_content.rb
lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb
lib/bandwidth-sdk/models/status_callback.rb
Expand Down Expand Up @@ -431,3 +436,8 @@ lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb
lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb
lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb
lib/bandwidth-sdk/version.rb
spec/unit/models/refer_call_status_enum_spec.rb
spec/unit/models/refer_complete_callback_spec.rb
spec/unit/models/refer_complete_method_enum_spec.rb
spec/unit/models/refer_spec.rb
spec/unit/models/sip_uri_spec.rb
92 changes: 92 additions & 0 deletions bandwidth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3215,6 +3215,21 @@ components:
Setting the conference state to `completed` ends the conference and
ejects all members.
example: completed
referCallStatusEnum:
type: string
enum:
- success
- failure
description: The status of the SIP REFER request.
example: success
referCompleteMethodEnum:
type: string
description: HTTP method used for referCompleteUrl callback.
default: POST
enum:
- GET
- POST
example: POST
machineDetectionModeEnum:
type: string
default: async
Expand Down Expand Up @@ -5053,6 +5068,83 @@ components:
$ref: '#/components/schemas/transferCallerId'
transferTo:
$ref: '#/components/schemas/transferTo'
sipUri:
type: object
description: SIP URI destination for Refer-To header.
properties:
sipUri:
type: string
description: SIP URI destination (e.g. sip:alice@atlanta.example.com).
example: sip:alice@atlanta.example.com
required:
- sipUri
refer:
type: object
description: Send a SIP REFER for an inbound SIP URI call.
properties:
referCompleteUrl:
type: string
description: Optional callback URL for referComplete event. Relative URL allowed.
referCompleteMethod:
$ref: '#/components/schemas/referCompleteMethodEnum'
tag:
type: string
description: Optional tag echoed in future callbacks. Max length 256.
maxLength: 256
sipUri:
$ref: '#/components/schemas/sipUri'
required:
- sipUri
referCompleteCallback:
type: object
description: >-
This event is sent to the referCompleteUrl of the <Refer> verb when the
SIP REFER request has been resolved — either the remote endpoint has
accepted and redirected the call (success) or the REFER was rejected or
timed out (failure). On success the original call is terminated.
properties:
eventType:
$ref: '#/components/schemas/eventType'
eventTime:
$ref: '#/components/schemas/eventTime'
accountId:
$ref: '#/components/schemas/accountId'
applicationId:
$ref: '#/components/schemas/applicationId1'
from:
$ref: '#/components/schemas/from'
to:
$ref: '#/components/schemas/to'
direction:
$ref: '#/components/schemas/callDirectionEnum'
callId:
$ref: '#/components/schemas/callId'
callUrl:
$ref: '#/components/schemas/callUrl'
startTime:
$ref: '#/components/schemas/startTime'
answerTime:
$ref: '#/components/schemas/answerTime'
tag:
$ref: '#/components/schemas/tag1'
referCallStatus:
$ref: '#/components/schemas/referCallStatusEnum'
referSipResponseCode:
type: integer
description: >-
The SIP response code received in response to the REFER request.
Present when the status of the REFER is known (e.g. 202 Accepted or
405 Method Not Allowed). Absent when the REFER was not attempted.
example: 202
nullable: true
notifySipResponseCode:
type: integer
description: >-
The SIP response code received in a NOTIFY from the remote endpoint
after it attempted to reach the transfer target. Present only if a
NOTIFY was received before the 30-second timeout.
example: 200
nullable: true
transcriptionAvailableCallback:
type: object
description: >-
Expand Down
6 changes: 6 additions & 0 deletions lib/bandwidth-sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,13 @@
require 'bandwidth-sdk/models/recording_transcriptions'
require 'bandwidth-sdk/models/redirect_callback'
require 'bandwidth-sdk/models/redirect_method_enum'
require 'bandwidth-sdk/models/refer'
Comment thread
atelegu marked this conversation as resolved.
require 'bandwidth-sdk/models/refer_call_status_enum'
require 'bandwidth-sdk/models/refer_complete_callback'
require 'bandwidth-sdk/models/refer_complete_method_enum'
require 'bandwidth-sdk/models/sip_connection_metadata'
require 'bandwidth-sdk/models/sip_credentials'
require 'bandwidth-sdk/models/sip_uri'
require 'bandwidth-sdk/models/sms_message_content'
require 'bandwidth-sdk/models/standalone_card_orientation_enum'
require 'bandwidth-sdk/models/status_callback'
Expand Down Expand Up @@ -235,6 +240,7 @@
require 'bandwidth-sdk/models/bxml/verbs/play_audio'
require 'bandwidth-sdk/models/bxml/verbs/record'
require 'bandwidth-sdk/models/bxml/verbs/redirect'
require 'bandwidth-sdk/models/bxml/verbs/refer'
require 'bandwidth-sdk/models/bxml/verbs/resume_recording'
require 'bandwidth-sdk/models/bxml/verbs/ring'
require 'bandwidth-sdk/models/bxml/verbs/send_dtmf'
Expand Down
14 changes: 14 additions & 0 deletions lib/bandwidth-sdk/models/bxml/verbs/refer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Bandwidth
module Bxml
class Refer < Bandwidth::Bxml::NestableVerb
def initialize(sip_uri, attributes = {})
super('Refer', nil, [sip_uri], attributes)
@attribute_map = {
refer_complete_url: 'referCompleteUrl',
refer_complete_method: 'referCompleteMethod',
tag: 'tag'
}
end
end
end
end
101 changes: 101 additions & 0 deletions lib/bandwidth-sdk/models/refer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
=begin
#Bandwidth
#Bandwidth's Communication APIs
The version of the OpenAPI document: 1.0.0
Contact: letstalk@bandwidth.com
Generated by: https://openapi-generator.tech
Generator version: 7.17.0
=end

require 'date'
require 'time'

module Bandwidth
#BXML <Refer> verb model. Sends a SIP REFER for an inbound SIP URI call
class Refer < ApiModelBase
attr_accessor :refer_complete_url
attr_accessor :refer_complete_method
attr_accessor :tag
attr_accessor :sip_uri

def self.attribute_map
{
:'refer_complete_url' => :'referCompleteUrl',
:'refer_complete_method' => :'referCompleteMethod',
:'tag' => :'tag',
:'sip_uri' => :'sipUri'
}
end

def self.acceptable_attribute_map
attribute_map
end

def self.acceptable_attributes
acceptable_attribute_map.values
end

def self.openapi_types
{
:'refer_complete_url' => :'String',
:'refer_complete_method' => :'ReferCompleteMethodEnum',
:'tag' => :'String',
:'sip_uri' => :'SipUri'
}
end

def self.openapi_nullable
Set.new([:'refer_complete_url', :'refer_complete_method', :'tag'])
end

def initialize(attributes = {})
raise ArgumentError, "attributes must be a Hash" unless attributes.is_a?(Hash)

acceptable_attribute_map = self.class.acceptable_attribute_map
attributes = attributes.each_with_object({}) do |(k, v), h|
raise ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Refer`." unless acceptable_attribute_map.key?(k.to_sym)
h[k.to_sym] = v
end

self.refer_complete_url = attributes[:'refer_complete_url'] if attributes.key?(:'refer_complete_url')
self.refer_complete_method = attributes[:'refer_complete_method'] if attributes.key?(:'refer_complete_method')
self.tag = attributes[:'tag'] if attributes.key?(:'tag')
self.sip_uri = attributes[:'sip_uri'] if attributes.key?(:'sip_uri')

# required nested destination
raise ArgumentError, "`sip_uri` is required for Bandwidth::Refer" if self.sip_uri.nil?
# optional validation
if !self.refer_complete_method.nil?
ReferCompleteMethodEnum.build_from_hash(self.refer_complete_method)
end
if !self.tag.nil? && self.tag.length > 256
raise ArgumentError, "`tag` max length is 256"
end
end

def self.build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
attributes = attributes.transform_keys(&:to_sym)
transformed_hash = {}
openapi_types.each_pair do |key, type|
if attributes.key?(attribute_map[key]) && !attributes[attribute_map[key]].nil?
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
end
end
new(transformed_hash)
end

def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next unless is_nullable && instance_variable_defined?(:"@#{attr}")
end
hash[param] = _to_hash(value)
end
hash
end
end
end
37 changes: 37 additions & 0 deletions lib/bandwidth-sdk/models/refer_call_status_enum.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
=begin
#Bandwidth
#Bandwidth's Communication APIs
The version of the OpenAPI document: 1.0.0
Contact: letstalk@bandwidth.com
Generated by: https://openapi-generator.tech
Generator version: 7.17.0
=end

require 'date'
require 'time'

module Bandwidth
class ReferCallStatusEnum
SUCCESS = "success".freeze
FAILURE = "failure".freeze

def self.all_vars
@all_vars ||= [SUCCESS, FAILURE].freeze
end

# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def self.build_from_hash(value)
new.build_from_hash(value)
end

# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def build_from_hash(value)
return value if ReferCallStatusEnum.all_vars.include?(value)
raise "Invalid ENUM value #{value} for class #ReferCallStatusEnum"
end
end
end
Loading