Code Monkey home page Code Monkey logo

res_speech_gdfe's Introduction

Configuration

Default Configuration

res_speech_gdfe.conf

The configuration for the Google DFE speech module is in the res_speech_gdfe.conf file in the Asterisk configuration directory. It is a standard format Asterisk configuration file.

[general] section

  • service_key - (required) the path to a JSON-format Google service key or the actual key itself.
  • endpoint - (optional) the URL for the DialogFlow API endpoint. Leave blank to use the default dialogflow.googleapis.com.
  • vad_voice_threshold - (optional) the average absolute amplitude of a packet to consider that packet to be 'voice'. The default is 512. Valid range 0-32767.
  • vad_voice_minimum_duration - (optional, milliseconds) the cumulative duration of consecutive 'voice' packets to consider the caller to be speaking. The default is 40 (milliseconds). Valid range 0-2147483647.
  • vad_silence_minimum_duration - (optional, milliseconds, not implemented) the cumulative duration of consecutive non-'voice' packets to consider the caller to be not speaking. The default is 500 (milliseconds). Valid range 0-2147483647. This setting currently has no effect as the end of speech is determined by DialogFlow.

Environment Variables

http_proxy

To access the DialogFlow endpoint via a proxy you must set the environment variable http_proxy to the URL of your proxy. This must be done for the Asterisk process as a whole.

Per-Call Configuration

Speech module behavior may be modified by using the SPEECH_ENGINE dialplan function. Available settings are:

  • session_id - set a session identifier to use when making DialogFlow API calls. This will be reflected in the history of the agent on the DialogFlow console. A default random value will be used if not provided.
  • project_id - set the project identifier to use when making DialogFlow API calls. This setting is required in order to determine which agent to use.
  • language - set the language for the recognition engine for when doing intent detection and prompt generation. The default is en. The engine has no visibility into the channel language -- if it has changed it is still necessary to set the engine language.
  • voice_threshold - set the average absolute amplitude of a packet to consider that packet to be 'voice' (see vad_voice_threshold, above).
  • voice_duration - set the cumulative duration of consecutive 'voice' packets to consider the caller to be speaking (see vad_voice_minimum_duration, above).
  • silence_duration - the cumulative duration of consecutive non-'voice' packets to consider the caller to be not speaking (see vad_silence_minimum_duration, above).

Usage

Setup

Before detecting intent for your calls, you must first:

  1. create the speech resource (only do this once),
  2. set the project_id, and
same =>   n,SpeechCreate()
same =>   n,Set(SPEECH_ENGINE(project_id)=my-project-12345)

Detecting Intent from Voice

To detect intent from voice, you should call SpeechBackground to send audio to the module. You may specify a prompt to play while performing the detection.

same =>   n,SpeechBackground(hello-world)

Detecting Intent by Event

To detect intent by event, you should activate a grammar with the name event:{your event name} prior to calling SpeechBackground. The SpeechBackground application will return immediately -- you should not include a prompt.

same =>   n,SpeechActivateGrammar(event:welcome)
same =>   n,SpeechBackground(hello-world)

Processing results

The DialogFlow module returns the following results (when available):

  • response_id - the unique identifier for this response
  • query_text - the text of the speech recognized by DialogFlow
  • language_code - the detected language of the recognized speech
  • action - the action for the detected intent
  • fulfillment_text - the text of the next prompt for the caller
  • intent_name - the API name of the intent detected
  • intent_display_name - the displayed name of the intent detected
  • raw_score - the raw recognition score
  • fulfillment_message_N_text_M - the fulfillment text messages from the response
  • fulfillment_message_N_simple_response_M - the simple response fulfillment messages from the response
  • fulfillment_message_N_telephony_play_audio - a URI from the telephony audio response fulfillment message
  • fulfillment_message_N_telephony_synthesize_speech - text or SSML from the telephony synthesized speech fulfillment message
  • fulfillment_message_N_telephony_transfer_call - a phone number for transferring from the telephony transfer call fulfillment message
  • fulfillment_message_N_telephony_terminate_call - a flag indicating that the fulfillment message requested call termination
  • fulfillment_audio - a path to audio corresponding to the fulfillment text

(those with N or M in the name may occur multiple times with different indexes in those positions)

res_speech_gdfe's People

Contributors

dandann00dle avatar davidalkhad avatar ktodd-usan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

res_speech_gdfe's Issues

The call is simply terminated

I am using Microsoft TTS successfully, but when it arrives in your "SpeechBackground" function, the connection is simply terminated. I activated the DialogFlow Enterprise Edition Essentials account.

Follow log:

== Setting global variable 'SIPDOMAIN' to 'MY_IP_STATIC'
-- Executing [5000@ramais:1] Goto("PJSIP/6001-00000001", "dialogflow,s,1") in new stack
-- Goto (dialogflow,s,1)
-- Executing [s@dialogflow:1] NoOp("PJSIP/6001-00000001", "Dialogflow") in new stack
-- Executing [s@dialogflow:2] Answer("PJSIP/6001-00000001", "") in new stack
> 0x7fb380012340 -- Strict RTP learning after remote address set to: IP:47634
> 0x7fb380012340 -- Strict RTP switching to RTP target address IP:47634 as source
-- Executing [s@dialogflow:3] SpeechCreate("PJSIP/6001-00000001", "") in new stack
-- Executing [s@dialogflow:4] Set("PJSIP/6001-00000001", "LANG_OVERRIDE=") in new stack
-- Executing [s@dialogflow:5] Set("PJSIP/6001-00000001", "SPEECH_ENGINE(project_id)=DIALOGFLOW_ID") in new stack
-- Executing [s@dialogflow:6] Set("PJSIP/6001-00000001", "SPEECH_ENGINE(session_id)=2332") in new stack
-- Executing [s@dialogflow:7] Set("PJSIP/6001-00000001", "SPEECH_ENGINE(language)=pt-BR") in new stack
-- Executing [s@dialogflow:8] GotoIf("PJSIP/6001-00000001", "1?clear_prompt") in new stack
-- Goto (dialogflow,s,10)
-- Executing [s@dialogflow:10] Set("PJSIP/6001-00000001", "PROMPT=hello-world") in new stack

-- Executing [s@dialogflow:11] AGI("PJSIP/6001-00000001", "mstts.agi,"Olá Luís.",pt-BR") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/mstts.agi
-- <PJSIP/6001-00000001> Playing '/tmp/2ad266c68b0c72f0baafcb84dc6c9054.slin16' (escape_digits=) (sample_offset 0) (language 'en')
-- <PJSIP/6001-00000001>AGI Script mstts.agi completed, returning 0
-- Executing [s@dialogflow:12] SpeechBackground("PJSIP/6001-00000001", "hello-world") in new stack

== Spawn extension (dialogflow, s, 12) exited non-zero on 'PJSIP/6001-00000001'

Install on running asterisk

Hi

I download all files, res files add to res folder in asterisk but when I compile asterisk there are no SO files for your C files
Can you make tutorial how to install?

Not able to capture adudio from call

I'm not able to capture audio, this is what i go:

[Dec 2 10:43:13] DEBUG[15071][C-00000000] channel.c: Scheduling timer at (0 requested / 0 actual) timer ticks per second
[Dec 2 10:43:13] DEBUG[15071][C-00000000] channel.c: Scheduling timer at (0 requested / 0 actual) timer ticks per second
[Dec 2 10:43:13] DEBUG[15071][C-00000000] channel.c: Scheduling timer at (0 requested / 0 actual) timer ticks per second
[Dec 2 10:43:13] DEBUG[15071][C-00000000] channel.c: Channel PJSIP/my-itsp-00000000 setting write format path: ulaw -> ulaw
[Dec 2 10:43:13] DEBUG[15073] res_speech_gdfe.c: Setting heard speech on [email protected]
[Dec 2 10:43:14] DEBUG[15073] libdfegrpc.cc: Session 1575283383.0 stopping recognition to voicebotdev-lgkadi
[Dec 2 10:43:14] DEBUG[15074] libdfegrpc.cc: Got final response '' ("" / "") for 1575283383.0
[Dec 2 10:43:14] DEBUG[15073] res_speech_gdfe.c: Exiting background thread for GDF [email protected]

Pls Help!

do not create file "/tmp/res_speech_gdfe_fulfillment_XXXXXX.wav"

Hi!
I get the following error

Executing [23@dialogflow-transfer:3] Playback("PJSIP/anonymous-00000002", ""/tmp/res_speech_gdfe_fulfillment_G5x5nl"") in new stack
[Jan 30 11:52:00] WARNING[1972][C-00000002]: format_wav.c:113 check_header_fmt: Unexpected frequency mismatch 24000 (expecting 8000)
[Jan 30 11:52:00] WARNING[1972][C-00000002]: file.c:472 fn_wrapper: Unable to open format wav
[Jan 30 11:52:00] WARNING[1972][C-00000002]: file.c:1247 ast_streamfile: Unable to open /tmp/res_speech_gdfe_fulfillment_G5x5nl (format (ulaw)): No such file or directory
[Jan 30 11:52:00] WARNING[1972][C-00000002]: app_playback.c:494 playback_exec: Playback failed on PJSIP/anonymous-00000002 for "/tmp/res_speech_gdfe_fulfillment_G5x5nl"
After that I open the / tmp directory and this file "res_speech_gdfe_fulfillment_G5x5nl.wav" is not
how do i solve this problem?
my conf gdfe
endpoint =
vad_voice_threshold = 1024
vad_voice_minimum_duration = 100
vad_silence_minimum_duration = 100
vad_barge_minimum_duration = 300
vad_end_of_speech_silence_duration = 500
endpointer_cache_audio_pretrigger_ms = 100
default_incomplete_timeout = 0
default_no_speech_timeout = 0
default_maximum_speech_timeout = 90000
call_log_location = /var/log/dialogflow/${APPLICATION}/${STRFTIME(,,%Y/%m/%d/%H)}/
enable_call_logs = Yes
enable_preendpointer_recordings = Yes
enable_postendpointer_recordings = Yes
record_preendpointer_on_demand = Yes
enable_sentiment_analysis = default
stop_writes_on_final_transcription = Yes
start_recognition_on_start = Yes
recognition_start_failure_retries = 4
recognition_start_failure_retry_max_time_ms = 1000
start_failure_retry_codes = ,,14,,
synthesize_fulfillment_text = Yes
model =
use_internal_endpointer_for_end_of_speech = Yes
hints =

my debug asterisk
Executing [23@dialogflow:1] NoOp("PJSIP/anonymous-00000002", "Dialogflow") in new stack
-- Executing [23@dialogflow:2] Answer("PJSIP/anonymous-00000002", "") in new stack
> 0xfb1720 -- Strict RTP learning after remote address set to: 192.168.0.3:4040
> 0xfb1720 -- Strict RTP switching to RTP target address 192.168.0.3:4040 as source
-- Executing [23@dialogflow:3] SpeechCreate("PJSIP/anonymous-00000002", "") in new stack
-- Executing [23@dialogflow:4] Set("PJSIP/anonymous-00000002", "LANG_OVERRIDE=") in new stack
-- Executing [23@dialogflow:5] Set("PJSIP/anonymous-00000002", "SPEECH_ENGINE(project_id)=test-ayur") in new stack
-- Executing [23@dialogflow:6] Set("PJSIP/anonymous-00000002", "SPEECH_ENGINE(session_id)=1580356318.6") in new stack
-- Executing [23@dialogflow:7] Set("PJSIP/anonymous-00000002", "SPEECH_ENGINE(language)=en") in new stack
-- Executing [23@dialogflow:8] GotoIf("PJSIP/anonymous-00000002", "1?clear_prompt") in new stack
-- Goto (dialogflow,23,10)
-- Executing [23@dialogflow:10] Set("PJSIP/anonymous-00000002", "PROMPT=") in new stack
-- Executing [23@dialogflow:11] SpeechActivateGrammar("PJSIP/anonymous-00000002", "event:welcome") in new stack
-- Executing [23@dialogflow:12] Goto("PJSIP/anonymous-00000002", "dialogflow-loop,23,start") in new stack
-- Goto (dialogflow-loop,23,1)
-- Executing [23@dialogflow-loop:1] NoOp("PJSIP/anonymous-00000002", "Dialogflow Loop Start") in new stack
-- Executing [23@dialogflow-loop:2] SpeechBackground("PJSIP/anonymous-00000002", "") in new stack
-- Executing [23@dialogflow-loop:3] Gosub("PJSIP/anonymous-00000002", "dialogflow-process-results,23,start") in new stack
-- Executing [23@dialogflow-process-results:1] NoOp("PJSIP/anonymous-00000002", "Got 13 results") in new stack
-- Executing [23@dialogflow-process-results:2] Set("PJSIP/anonymous-00000002", "PROMPT=") in new stack
-- Executing [23@dialogflow-process-results:3] Set("PJSIP/anonymous-00000002", "i=0") in new stack
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=response_id") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=0cc212e3-1003-4dfc-afb2-3b01db3a3608-426bc00a") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=1") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=query_text") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=welcome") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=2") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=language_code") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=ru") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=3") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=action") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=input.welcome") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=4") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=fulfillment_text") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=Добрый день!") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=5") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=intent_name") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=projects/test-ayur/agent/intents/646b0dbf-7eba-45e3-92bf-7bfdcd9642ed") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=6") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=intent_display_name") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=Default Welcome Intent") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=7") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=intent_detection_confidence") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=1.000000") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=8") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=text") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=Добрый день!") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=9") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=date") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=10") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=alternate_result_count") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=0") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=11") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=waveformDuration") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=0") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "1?increment") in new stack
-- Goto (dialogflow-process-results,23,11)
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=12") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "1?process-results") in new stack
-- Goto (dialogflow-process-results,23,4)
-- Executing [23@dialogflow-process-results:4] Set("PJSIP/anonymous-00000002", "GRAMMAR=fulfillment_audio") in new stack
-- Executing [23@dialogflow-process-results:5] Set("PJSIP/anonymous-00000002", "VALUE=/tmp/res_speech_gdfe_fulfillment_G5x5nl.wav") in new stack
-- Executing [23@dialogflow-process-results:6] GotoIf("PJSIP/anonymous-00000002", "1?checkforaudio") in new stack
-- Goto (dialogflow-process-results,23,8)
-- Executing [23@dialogflow-process-results:8] GotoIf("PJSIP/anonymous-00000002", "0?increment") in new stack
-- Executing [23@dialogflow-process-results:9] Set("PJSIP/anonymous-00000002", "PROMPT="/tmp/res_speech_gdfe_fulfillment_G5x5nl"") in new stack
-- Executing [23@dialogflow-process-results:10] Set("PJSIP/anonymous-00000002", "PROMPTFULLNAME="/tmp/res_speech_gdfe_fulfillment_G5x5nl.wav"") in new stack
-- Executing [23@dialogflow-process-results:11] Set("PJSIP/anonymous-00000002", "i=13") in new stack
-- Executing [23@dialogflow-process-results:12] GotoIf("PJSIP/anonymous-00000002", "0?process-results") in new stack
-- Executing [23@dialogflow-process-results:13] Return("PJSIP/anonymous-00000002", "") in new stack
-- Executing [23@dialogflow-loop:4] GotoIf("PJSIP/anonymous-00000002", "1?dialogflow-transfer,23,start") in new stack
-- Goto (dialogflow-transfer,23,1)
-- Executing [23@dialogflow-transfer:1] NoOp("PJSIP/anonymous-00000002", "Transferring to 23") in new stack
-- Executing [23@dialogflow-transfer:2] GotoIf("PJSIP/anonymous-00000002", "0?dotransfer") in new stack
-- Executing [23@dialogflow-transfer:3] Playback("PJSIP/anonymous-00000002", ""/tmp/res_speech_gdfe_fulfillment_G5x5nl"") in new stack
[Jan 30 11:52:00] WARNING[1972][C-00000002]: format_wav.c:113 check_header_fmt: Unexpected frequency mismatch 24000 (expecting 8000)
[Jan 30 11:52:00] WARNING[1972][C-00000002]: file.c:472 fn_wrapper: Unable to open format wav
[Jan 30 11:52:00] WARNING[1972][C-00000002]: file.c:1247 ast_streamfile: Unable to open /tmp/res_speech_gdfe_fulfillment_G5x5nl (format (ulaw)): No such file or directory
[Jan 30 11:52:00] WARNING[1972][C-00000002]: app_playback.c:494 playback_exec: Playback failed on PJSIP/anonymous-00000002 for "/tmp/res_speech_gdfe_fulfillment_G5x5nl"
-- Executing [23@dialogflow-transfer:4] Transfer("PJSIP/anonymous-00000002", "") in new stack
[Jan 30 11:52:00] WARNING[1972][C-00000002]: app_transfer.c:95 transfer_exec: Transfer requires an argument ([Tech/]destination)
-- Executing [23@dialogflow-transfer:5] GotoIf("PJSIP/anonymous-00000002", "0?transferfailed") in new stack
-- Executing [23@dialogflow-transfer:6] GotoIf("PJSIP/anonymous-00000002", "0?transferunsupported") in new stack
-- Executing [23@dialogflow-transfer:7] Hangup("PJSIP/anonymous-00000002", "") in new stack
== Spawn extension (dialogflow-transfer, 23, 7) exited non-zero on 'PJSIP/anonymous-00000002'

Initial setting

Hello,
Thank you very much for sharing this project, for the description is exactly what I was looking for. But I'm confused how to do the initial configuration, in your build.sh file is a build to create asterisk from zero, right?

Disconnects at SpeechBackground()

I'm not able use it as per documentation. A simple example would be highly appreciated.

Here is my extensions.conf

[globals]

[dialogflow]
exten => _[a-z0-9].,1,NoOp(Dialogflow)
 same =>   n,Answer
 same =>   n,SpeechCreate()
 same =>   n,Set(SPEECH_ENGINE(project_id)=test-rrklnk)
 same =>   n,Set(SPEECH_ENGINE(session_id)=${UNIQUEID})
 same =>   n,Set(SPEECH_ENGINE(language)=${CHANNEL(language)})
 same =>   n(clear_prompt),Set(PROMPT=) 
 same =>   n,Goto(dialogflow-loop,${EXTEN},start)

[dialogflow-loop]
exten => _[a-z0-9].,1(start),NoOp(Dialogflow Loop Start)
 same =>   n,SpeechBackground(hello-world)
 same =>   n,GoSub(dialogflow-process-results,${EXTEN},start)
 same =>   n,Hangup

[dialogflow-process-results]
exten => _[a-z0-9].,1(start),NoOp(Got ${SPEECH(results)} results)
 same =>   n,Set(PROMPT=)
 same =>   n,Set(i=0)
 same =>   n(process-results),Set(GRAMMAR=${SPEECH_GRAMMAR(${i})})
 same =>   n,Set(VALUE=${SPEECH_TEXT(${i})})
 same =>   n(checkfortransfer),GotoIf($["${GRAMMAR}"=~"transfer_call"=0]?checkforaudio)
 same =>   n,Set(TRANSFER=${VALUE})
 same =>   n(checkforaudio),GotoIf($["${GRAMMAR}"!="fulfillment_audio"]?increment)
 ; prompt is everything but .wav
 same =>   n,Set(PROMPT="${VALUE:0:-4}")
 same =>   n,Set(PROMPTFULLNAME="${VALUE}")
 same =>   n(increment),Set(i=$[${i}+1])
 same =>   n,GotoIf($[${SPEECH(results)}>${i}]?process-results)
 same =>   n,Return()

[dialogflow-transfer]
exten => _[a-z0-9].,1(start),NoOp(Transferring to ${EXTEN})
 same =>   n,GotoIf($[${LEN("${PROMPT}")}=0]?dotransfer)
 same =>   n,Playback(${PROMPT})
 same =>   n(dotransfer),Transfer(${TRANSFER})
 same =>   n,GotoIf($["${TRANSFERSTATUS}"="${FAILURE}"]?transferfailed)
 same =>   n,GotoIf($["${TRANSFERSTATUS}"="${UNSUPPORTED}"]?transferunsupported)
 same =>   n,Hangup ; success!
 same =>   n(transferfailed),Playback(all-circuits-busy-now)
 same =>   n,Hangup
 same =>   n(transferunsupported),Playback(ss-noservice)
 same =>   n,Hangup

asterisk console messages:

  == Using SIP RTP CoS mark 5
       > 0x7fccdc00cf40 -- Strict RTP learning after remote address set to: 192.168.43.1:14758
    -- Executing [888@dialogflow:1] NoOp("SIP/6002-00000074", "Dialogflow") in new stack
    -- Executing [888@dialogflow:2] Answer("SIP/6002-00000074", "") in new stack
[Sep  6 19:07:44] WARNING[30771][C-0000007b]: res_rtp_asterisk.c:7077 ast_rtp_read: RTP Read too short
[Sep  6 19:07:44] WARNING[30771][C-0000007b]: res_rtp_asterisk.c:7077 ast_rtp_read: RTP Read too short
[Sep  6 19:07:44] WARNING[30771][C-0000007b]: res_rtp_asterisk.c:7077 ast_rtp_read: RTP Read too short
[Sep  6 19:07:44] WARNING[30771][C-0000007b]: res_rtp_asterisk.c:7077 ast_rtp_read: RTP Read too short
    -- Executing [888@dialogflow:3] SpeechCreate("SIP/6002-00000074", "") in new stack
    -- Executing [888@dialogflow:4] Set("SIP/6002-00000074", "SPEECH_ENGINE(project_id)=test-rrklnk") in new stack
    -- Executing [888@dialogflow:5] Set("SIP/6002-00000074", "SPEECH_ENGINE(session_id)=1567777064.224") in new stack
    -- Executing [888@dialogflow:6] Set("SIP/6002-00000074", "SPEECH_ENGINE(language)=en") in new stack
    -- Executing [888@dialogflow:7] Set("SIP/6002-00000074", "PROMPT=") in new stack
    -- Executing [888@dialogflow:8] Goto("SIP/6002-00000074", "dialogflow-loop,888,start") in new stack
    -- Goto (dialogflow-loop,888,1)
    -- Executing [888@dialogflow-loop:1] NoOp("SIP/6002-00000074", "Dialogflow Loop Start") in new stack
    -- Executing [888@dialogflow-loop:2] SpeechBackground("SIP/6002-00000074", "hello-world") in new stack
  == Spawn extension (dialogflow-loop, 888, 2) exited non-zero on 'SIP/6002-00000074'

Warnings at SpeechBackground() Could not create google credentials

Hi.
I installed clear Centos 7.
After installed speech driver with all dependencies.
The only thing I replaced is pjsip to sip channel driver.
In asterisk config folder I put svc_key.json with google credentials (Service account with DialogFlow API role).
Set environment GOOGLE_APPLICATION_CREDENTIALS
When i make call, I get warnings (project in logs replaced)

    -- Executing [PROJECT_ID@dialogflow-loop:1] NoOp("SIP/1000-00000000", "Dialogflow Loop Start") in new stack
    -- Executing [PROJECT_ID@dialogflow-loop:2] SpeechBackground("SIP/1000-00000000", "") in new stack
[Sep 24 09:27:04] WARNING[5729]: src/core/lib/security/credentials/google_default/credentials_generic.cc:34 grpc: Could not get HOME environment variable.
[Sep 24 09:27:04] WARNING[5729]: src/core/lib/security/credentials/google_default/google_default_credentials.cc:285 grpc: Could not create google default credentials.
[Sep 24 09:27:04] WARNING[5729]: src/core/lib/security/credentials/google_default/google_default_credentials.cc:290 grpc: grpc_google_default_credentials_create: {"created":"@1569310024.697116222","description":"Failed to create Google credentials","file":"src/core/lib/security/credentials/google_default/google_default_credentials.cc","file_line":227,"referenced_errors":[{"created":"@1569310024.697198073","description":"creds_path unset","file":"src/core/lib/security/credentials/google_default/google_default_credentials.cc","file_line":170},{"created":"@1569310024.697413861","description":"creds_path unset","file":"src/core/lib/security/credentials/google_default/google_default_credentials.cc","file_line":170}]}
[Sep 24 09:27:04] WARNING[5729]: src/core/ext/filters/client_channel/channel_connectivity.cc:49 grpc: grpc_channel_check_connectivity_state called on something that isnot a client channel, but 'lame-client'
[Sep 24 09:27:04] NOTICE[5729]: libdfegrpc.cc:564 int df_recognize_event(dialogflow_session*, const char*, const char*, int): Session 1569310024.0 got error performingevent detection on PROJECT_ID: lame client channel (2: )
[Sep 24 09:27:04] WARNING[5729]: res_speech_gdfe.c:1615 start_dialogflow_recognition: Error recognizing event on [email protected]

What I did wrong, help to understand.
Test client in folder libdfegrpc works with this key.

./test_client -e hello -k key.json -p PROJECT_ID

but the queries come up empty
image

Could not create google default credentials - No such file or directory

Hi,

i copied json file to svc_key.json.

pbx*CLI> gdfe show config
[general]
service_key = {
  "type": "service_account",
  "project_id": "pierwszy-XXXX",
  "private_key_id": "DELETED",
  "private_key": "-----BEGIN PRIVATE
KEY-----\nDELETED\n-----END
PRIVATE KEY-----\n",
  "client_email": "[email protected]",
  "client_id": "10899825XXXXX",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/pierwszy-XXXX%40appspot.gserviceaccount.com"
}

endpoint =
vad_voice_threshold = 1024
vad_voice_minimum_duration = 100
vad_silence_minimum_duration = 100
vad_barge_minimum_duration = 300
vad_end_of_speech_silence_duration = 500
endpointer_cache_audio_pretrigger_ms = 100
default_incomplete_timeout = 0
default_no_speech_timeout = 0
default_maximum_speech_timeout = 90000
call_log_location = /var/log/dialogflow/${APPLICATION}/${STRFTIME(,,%Y/%m/%d/%H)}/
enable_call_logs = Yes
enable_preendpointer_recordings = No
enable_postendpointer_recordings = No
record_preendpointer_on_demand = No
enable_sentiment_analysis = default
stop_writes_on_final_transcription = Yes
start_recognition_on_start = No
recognition_start_failure_retries = 4
recognition_start_failure_retry_max_time_ms = 1000
start_failure_retry_codes = ,14,
synthesize_fulfillment_text = No
model =
use_internal_endpointer_for_end_of_speech = No
hints =

but still getting this error:

[Nov 20 07:33:39] WARNING[125302] src/core/lib/security/credentials/google_default/google_default_credentials.cc: Could not create google default credentials.
[Nov 20 07:33:39] WARNING[125302] src/core/lib/security/credentials/google_default/google_default_credentials.cc: grpc_google_default_credentials_create: {"created":"@1574253219.639110426","description":"Failed to create Google credentials","file":"src/core/lib/security/credentials/google_default/google_default_credentials.cc","file_line":227,"referenced_errors":[{"created":"@1574253219.639116826","description":"creds_path unset","file":"src/core/lib/security/credentials/google_default/google_default_credentials.cc","file_line":170},{"created":"@1574253219.639142126","description":"Failed to load file","file":"src/core/lib/iomgr/load_file.cc","file_line":71,"filename":"/root/.config/gcloud/application_default_credentials.json","referenced_errors":[{"created":"@1574253219.639139426","description":"OS Error","errno":2,"file":"src/core/lib/iomgr/load_file.cc","file_line":45,"os_error":"No such file or directory","syscall":"fopen"}]}]}
[Nov 20 07:33:39] WARNING[125302] src/core/ext/filters/client_channel/channel_connectivity.cc: grpc_channel_check_connectivity_state called on something that is not a client channel, but 'lame-client'
[Nov 20 07:33:39] DEBUG[125302] libdfegrpc.cc: Channel to dialogflow.googleapis.com created for 1574253219.3
[Nov 20 07:33:39] DEBUG[125302] libdfegrpc.cc: Session 1574253219.3 performing event recognition on projects/pierwszy-XXXX/agent/sessions/1574253219.3
[Nov 20 07:33:39] NOTICE[125302] libdfegrpc.cc: Session 1574253219.3 got error performing event detection on pierwszy-XXXX: lame client channel (2: )
[Nov 20 07:33:39] WARNING[125302] res_speech_gdfe.c: Error recognizing event on [email protected]

Why i need this file "/root/.config/gcloud/application_default_credentials.json" ?
Even if i created this file it still dont work:
[Nov 20 07:50:29] WARNING[126245] src/core/lib/security/credentials/google_default/google_default_credentials.cc: grpc_google_default_credentials_create: {"created":"@1574254229.948937302","description":"Failed to create Google credentials","file":"src/core/lib/security/credentials/google_default/google_default_credentials.cc","file_line":227,"referenced_errors":[{"created":"@1574254229.948953302","description":"creds_path unset","file":"src/core/lib/security/credentials/google_default/google_default_credentials.cc","file_line":170},{"created":"@1574254229.949101600","description":"Failed to parse JSON","file":"src/core/lib/security/credentials/google_default/google_default_credentials.cc","file_line":182,"raw_bytes":"type\u0000service_account\u0000project_id\u0000pierwszy-XXXX\u0000private_key_id\uDELETED\u0000private_key\u0000-----BEGIN PRIVATE ivate_key": "-----BEGIN PRIVATE \nKEY-----\nDELETED\n-----END \nPRIVATE KEY-----\n",\n "client_email": "[email protected]",\n "client_id": "DELETED",\n "auth_uri": "https://accounts.google.com/o/oauth2/auth",\n "token_uri": "https://oauth2.googleapis.com/token",\n "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",\n "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/pierwszy-XXXXX%40appspot.gserviceaccount.com"\n}\n"}]}

Will be gratefull for any tips....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.