问题
I would like to call to my customer mobile numbers from my web application browser itself(head phones with mike) as live(RTC) and should able to record audio also.
Is it possible scenario with twilio api?
回答1:
I'm a Twilio developer evangelist and I think I can help here.
You can indeed do all of that. We have a quickstart guide on the Twilio website that gets you set up with making phone calls from your browser that you can follow to get 90% of the way there. You may need to adapt the example from Sinatra to Rails (as your question is tagged).
In order to record the calls, there is only one thing you'd need to change from the example TwiML when making an outgoing call. You just need to add in :record => true to the parameters you pass to the Dial verb. Below is the example code with the addition of the record parameter.
post '/voice' do
number = params[:PhoneNumber]
response = Twilio::TwiML::Response.new do |r|
# Should be your Twilio Number or a verified Caller ID
r.Dial :callerId => caller_id, :record => true do |d|
# Test to see if the PhoneNumber is a number, or a Client ID. In
# this case, we detect a Client ID by the presence of non-numbers
# in the PhoneNumber parameter.
if /^[\d\+\-\(\) ]+$/.match(number)
d.Number(CGI::escapeHTML number)
else
d.Client default_client
end
end
end
response.text
end
Once you have made the recording, you can then then get hold of your recordings through the REST API like so:
require 'twilio-ruby'
client = Twilio::REST::Client.new ACCOUNT_SID, ACCOUNT_AUTH_TOKEN
recordings = client.account.recordings.list
There's more information on the recordings API resource in the REST documentation
So, take a look at the quickstart guide and let me know if this helps.
来源:https://stackoverflow.com/questions/25419182/can-i-make-a-call-from-application-to-personal-mobile-number-by-using-the-twilio