我可以使用 twilio 从应用程序拨打个人手机号码吗? [英] Can I make a call from application to personal mobile number by using the twilio?

查看:12
本文介绍了我可以使用 twilio 从应用程序拨打个人手机号码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过我的网络应用程序浏览器本身(带麦克风的耳机)实时呼叫我的客户手机号码(RTC),并且应该也能够录制音频.

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.

twilio api 是否可能出现这种情况?

Is it possible scenario with twilio api?

推荐答案

我是 Twilio 开发人员的布道者,我想我可以在这里提供帮助.

I'm a Twilio developer evangelist and I think I can help here.

您确实可以做到所有这些.我们有一个Twilio 网站上的快速入门指南,可以帮助您设置为从您的浏览器拨打电话,您可以按照该电话完成 90% 的通话.您可能需要将 Sinatra 中的示例改编为 Rails(因为您的问题已被标记).

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).

为了记录通话,您只需要从 拨打电话时的示例 TwiML.您只需要添加 :record =>true 传递给 Dial 动词的参数.下面是添加了记录参数的示例代码.

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

完成录音后,您就可以通过 REST API 获取您的录音,如下所示:

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

REST 文档中有关于 recordings API 资源的更多信息

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.

这篇关于我可以使用 twilio 从应用程序拨打个人手机号码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆