使用Ruby或PhpHi ANyone调用nexmo语音API流

时间:2018-04-05 10:29:09

标签: php ruby nexmo

任何人都使用Nexmo语音API为活动呼叫创建Stream音频文件 https://developer.nexmo.com/api/voice#stream-an-audio-file-to-an-active-call

使用php或ruby或任何其他语言的任何示例源代码?

感谢。

2 个答案:

答案 0 :(得分:0)

为什么不看看红宝石宝石?

https://github.com/Nexmo/nexmo-ruby

答案 1 :(得分:0)

Nexmo Ruby gem的自述文件包含streaming audio to a call.

的代码示例
require 'nexmo'

client = Nexmo::Client.new(api_key: 'YOUR-API-KEY', api_secret: 'YOUR-API-SECRET')

response = client.calls.create({
  to: [{type: 'phone', number: 'TO-NUMBER'}],
  from: {type: 'phone', number: 'FROM-NUMBER'},
  answer_url: ['https://example.com/answer']
})

stream_url = 'https://nexmo-community.github.io/ncco-examples/assets/voice_api_audio_streaming.mp3'

response = client.stream.start("CALL-UUID", stream_url: stream_url)