Excerpt |
---|
This page contains code snippets that demonstrate various Unified API requests that can be implemented in your App when using the Ruby language. |
Requirements
Ruby 1.9.3 or higher with SSL support is required.
Note |
---|
title | The code is on GitHub |
---|
|
Download here. Do not hesitate to contribute in order to make this example better - we welcome Pull Requests! |
Make a Call Between Two Public Numbers
The example below demonstrates how you can use Unified API to connect two public numbers, not registered with VoipNow. It uses the Create Simple PhoneCalls request.
Code Block |
---|
curl "https://raw.githubusercontent.com/4psa/uapi-example-ruby/01_public_call.rb" -o 01_public_call.rb -L |
Make a Sandbox Call
Unified API can be tested using the Sandbox numbers. The example below uses the Create Simple PhoneCalls request to make the call.
Code Block |
---|
curl "https://raw.githubusercontent.com/4psa/uapi-example-ruby/02_sandbox_call.rb" -o 02_sandbox_call.rb -L |
Park a Phone Call
The example below demonstrates how you can use Unified API to park a party of an ongoing phone call. It uses the Park PhoneCalls request.
Code Block |
---|
curl "https://raw.githubusercontent.com/4psa/uapi-example-ruby/03_park_call.rb" -o 03_park_call.rb -L |
Transfer a Call to a Public Number
The example below demonstrates how you can use Unified API to transfer a call to a public number, not registered with VoipNow. It uses the Transfer PhoneCalls request.
Code Block |
---|
curl "https://raw.githubusercontent.com/4psa/uapi-example-ruby/04_transfer_call.rb" -o 04_transfer_call.rb -L |
Record an Ongoing Conversation
The example below demonstrates how you can use Unified API to record an ongoing conversation. This action is possible for phone numbers that are registered with VoipNow. The recording is saved in the wav format and uses the StartRecording PhoneCalls request.
Code Block |
---|
curl "https://raw.githubusercontent.com/4psa/uapi-example-ruby/05_record_call.rb" -o 05_record_call.rb -L |
Log in an Agent to a Queue
Anchor |
---|
| demo-queue-ag |
---|
| demo-queue-ag |
---|
|
The example below demonstrates how you can use Unified API to log in an agent to a queue. It uses the Update QueueAgents request.
Code Block |
---|
curl "https://raw.githubusercontent.com/4psa/uapi-example-ruby/06_agent_login.rb" -o 06_agent_login.rb -L |
List the Registration Status of an Extension
Anchor |
---|
| demo-ext-pres |
---|
| demo-ext-pres |
---|
|
The example below demonstrates how you can use Unified API to list the status of an extension. It uses the List Presence request.
Code Block |
---|
curl "https://raw.githubusercontent.com/4psa/uapi-example-ruby/07_list_registration.rb" -o 07_list_registration.rb -L |