Class: Zavudev::Resources::Calls
- Inherits:
-
Object
- Object
- Zavudev::Resources::Calls
- Defined in:
- lib/zavudev/resources/calls.rb,
sig/zavudev/resources/calls.rbs
Instance Method Summary collapse
-
#create(to:, greeting: nil, language: nil, max_duration_minutes: nil, metadata: nil, sender_id: nil, request_options: {}) ⇒ Zavudev::Models::CallCreateResponse
Some parameter documentations has been truncated, see Models::CallCreateParams for more details.
-
#hangup(call_id, request_options: {}) ⇒ Zavudev::Models::CallHangupResponse
End an active voice call.
-
#initialize(client:) ⇒ Calls
constructor
private
A new instance of Calls.
-
#list(cursor: nil, direction: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::CallListResponse>
Some parameter documentations has been truncated, see Models::CallListParams for more details.
-
#retrieve(call_id, request_options: {}) ⇒ Zavudev::Models::CallRetrieveResponse
Retrieve a single voice call, including its full transcript once the conversation has produced turns.
Constructor Details
#initialize(client:) ⇒ Calls
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.
Returns a new instance of Calls.
142 143 144 |
# File 'lib/zavudev/resources/calls.rb', line 142 def initialize(client:) @client = client end |
Instance Method Details
#create(to:, greeting: nil, language: nil, max_duration_minutes: nil, metadata: nil, sender_id: nil, request_options: {}) ⇒ Zavudev::Models::CallCreateResponse
Some parameter documentations has been truncated, see Models::CallCreateParams for more details.
Place an outbound voice call answered by the voice agent configured on the sender. Zavu dials the recipient and runs the conversation through its managed voice pipeline (speech recognition, the agent's LLM, and speech synthesis, with real-time interruption handling).
Requirements:
- The Voice Agents feature must be enabled for your team (otherwise
403). - An account that has verified nothing may only call the phone numbers the
project has verified (
403with codedestination_not_verified, anddetails.verifiedNumberslists them), and at most 5 calls a day (429with codedaily_limit_exceeded). A number is verified from the dashboard's Sandbox screen by sending the pre-filled WhatsApp message from that phone; the same verification covers SMS and calls. Verify your identity, add a payment method, settle a deposit or subscribe to call any destination. That raises the ceiling to 50 calls a day on Free; paid plans have no daily call ceiling. Full reference: https://docs.zavu.dev/concepts/sending-limits - The sender's agent must have
voice.enabledset totrue. - Not available with test-mode API keys.
Billing: Voice calls are billed per minute of connected time plus telephony, deducted from your prepaid balance. A short-duration estimate is reserved when the call is placed; you are charged for the actual duration when the call ends.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/zavudev/resources/calls.rb', line 52 def create(params) parsed, = Zavudev::CallCreateParams.dump_request(params) @client.request( method: :post, path: "v1/calls", body: parsed, model: Zavudev::Models::CallCreateResponse, options: ) end |
#hangup(call_id, request_options: {}) ⇒ Zavudev::Models::CallHangupResponse
End an active voice call. The call must still be ringing or in progress. Not available with test-mode API keys.
130 131 132 133 134 135 136 137 |
# File 'lib/zavudev/resources/calls.rb', line 130 def hangup(call_id, params = {}) @client.request( method: :post, path: ["v1/calls/%1$s/hangup", call_id], model: Zavudev::Models::CallHangupResponse, options: params[:request_options] ) end |
#list(cursor: nil, direction: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::CallListResponse>
Some parameter documentations has been truncated, see Models::CallListParams for more details.
List voice calls for this project, most recent first. Transcripts are omitted from the list; fetch a single call to get its transcript.
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/zavudev/resources/calls.rb', line 105 def list(params = {}) parsed, = Zavudev::CallListParams.dump_request(params) query = Zavudev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/calls", query: query, page: Zavudev::Internal::Cursor, model: Zavudev::Models::CallListResponse, options: ) end |
#retrieve(call_id, request_options: {}) ⇒ Zavudev::Models::CallRetrieveResponse
Retrieve a single voice call, including its full transcript once the conversation has produced turns.
75 76 77 78 79 80 81 82 |
# File 'lib/zavudev/resources/calls.rb', line 75 def retrieve(call_id, params = {}) @client.request( method: :get, path: ["v1/calls/%1$s", call_id], model: Zavudev::Models::CallRetrieveResponse, options: params[:request_options] ) end |