Make Voice calls through Ruby on Rails Web applications

In today’s life everyone is busy with there work, no one wants to recieve unwanted or spam calls to their phones. So, if you want to filter out the spam calls or unpriority calls you can do so using Plivo. Plivo provides Ruby SDK as well as well-maintained documentation to integrate Plivo for voice calls in application. Here, I am demonstrating how to create your first voice call using Plivo in Ruby on Rails Web Application First of all you should have rails application. I am creating new here, $ rails new plivo_demo Add $ gem ‘plivo’, ‘>= 4.8.1’ to Gemfile and run $ bundle command Get Plivo credentials: – Goto:  Note: if you don’t have an account, create one once login to Plivo Dashboard, you can see Plivo credentials as : Auth ID: MANDA0ZTU4ZTG2ZWU4MM Auth Token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX These are sandbox credentials, plivo provides some amount to try and test the APIs. Also add sandbox numbers if using trial: – goto Phone Numbers menu – goto Sandbox Numbers – Add sandbox number – verify OTP – done! For live you can purchase the Plivo plan as per your feasibility So, now let’s create simple CRUD for creating call using scaffold
$ rails g scaffold calls from:string to:string duration:string status:string recording:string $ rake db:migrate $ root “calls#index”
Let’s add the logic to create a voice call, excited!! Syntax:
client = call_made = client.calls.create( ‘your_source_number’, [‘your_destination_number’], ‘https://answer.url’ )
Store these variables in ENV file :
add below code in calls_controller > create action
api =, PLIVO_AUTH_TOKEN) begin response = api.calls.create(calls_params[:from],[calls_params[:to]],'') puts response rescue PlivoRESTError => e puts 'Exception: ' + e.message end
Above code will make call to destination number from source number on click on create_call button You can make changes in call flow as per your requirement such as update call status, end call after some time, etc. Thanks! reference: plivo documentation With more than a decade of experience in imparting top-notch expertise in Ruby on Rails Development with early adoption of agile process, we are happy to help your business with lean and mean development solutions that utilise the tech-stack best-suited for your business to stay ahead in its target market and enjoy significant competitive advantage. Contact us to learn how you can achieve this for your business.

Subscribe For Latest Updates

Related Posts

Leave a Comment

Your email address will not be published. Required fields are marked *