Skip to content

twilioforkwc/twilio-media-stream-live-transcription-AmiVoice

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio Media Streams と AmiVoice Cloud Platformの連携サンプル

このサンプルはTwilioの電話音声をリアルタイムに取得できるTwilio Media StreamsとAmiVoice Cloud Platformの連携サンプルです。

App sever setup

Installation

Requires Node >= v12.1.0

以下コマンドを実行

npm install

Running the server

以下コマンドを実行

node ./server.js

Setup

設定

  1. Twilio アカウント作成

  2. 電話番号の購入

  3. AmiVoice Cloud Platform アカウント作成

  4. .env.exampleファイルをコピーして.envファイルを作成

  5. AMIVOICE_API_KEYにAmiVoice Cloud Platformのマイページから取得したAPIキーを設定

  6. ngrokを起動 ngrok http 8080

  7. templates/streamsファイルの<ngrok url>部分を上記手順で起動した、ngrokのドメインに修正

  8. 購入した、電話番号のA CALL COMES INに<ngrok url>/twimlを設定 例:'https://xxxx.ngrok.io/twiml'

動作例

本サンプルはリアルタイムで認識した文字をコンソールに出力いたします。

2022-02-03T00:59:26.634Z POST TwiML
2022-02-03T00:59:28.141Z Media WS: Connection accepted
2022-02-03T00:59:28.342Z Media WS: Connected event received:  { event: 'connected', protocol: 'Call', version: '0.2.0' }
2022-02-03T00:59:28.344Z Media WS: Start event received:  {
  event: 'start',
  sequenceNumber: '1',
  start: {
    accountSid: '',
    streamSid: '',
    callSid: '',
    tracks: [ 'inbound' ],
    mediaFormat: { encoding: 'audio/x-mulaw', sampleRate: 8000, channels: 1 }
  },
  streamSid: ''
}
Amivoice connected
s mulaw -a-general authorization=
AmiVoice started.
認識中 track:inbound message:1...
認識中 track:inbound message:一番...
認識中 track:inbound message:19...
認識中 track:inbound message:199...
認識中 track:inbound message:1級建築...
認識中 track:inbound message:一番吸収した...
確定  track:inbound message:一番吸収した。
2022-02-03T00:59:34.050Z inbound:一番吸収した。
send close command
AmiVoice closed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.8%
  • Shell 0.2%