Powered by Universal Speech Solutions LLC

 MRCP

Asterisk and Google SR

Usage Guide

 

Revision: 1

Created: June 22, 2017

Last updated: June 22, 2017

Author: Arsen Chaloyan


 

Table of Contents

 

1  Overview.. 4

1.1         Applicable Versions. 4

2  Generic Speech Recognition API 5

2.1         Overview.. 5

2.2         Configuration Steps. 5

2.3         Usage Examples. 5

3  Suite of UniMRCP Applications. 7

3.1         Overview.. 7

3.2         Configuration Steps. 7

3.3         Usage Examples. 8

 

 


1       Overview

This guide describes how to utilize the Google Cloud Speech services with Asterisk.

 

H

 

Note that the Asterisk and the UniMRCP server typically reside on different hosts in a LAN, although both might be installed on the same host.

 

Installation of the Asterisk and the UniMRCP server with the Google SR plugin is not covered in this document. Visit the corresponding web pages for more information.

 

http://unimrcp.org/asterisk

http://unimrcp.org/gsr

 

1.1      Applicable Versions

Instructions provided in this guide are applicable to the following versions.

 

UniMRCP Modules for Asterisk 1.4.0 and above

UniMRCP GSR Plugin 1.1.0 and above

 

2       Generic Speech Recognition API

2.1      Overview

The module res_speech_unimrcp.so provides an implementation of the Generic Speech Recognition API of Asterisk, based on the UniMRCP client library.

2.2      Configuration Steps

This section outlines major configuration steps required for use of the module res_speech_unimrcp.so with the UniMRCP server.

 

Check the name of the profile, referenced in the configuration file res-speech-unimrcp.conf, which is located in the configuration directory of Asterisk. Use uni2 for MRCPv2, and uni1 for MRCPv1.

 

[general]

unimrcp-profile = uni2      ; UniMRCP MRCPv2 Server

; unimrcp-profile = uni1    ; UniMRCP MRCPv1 Server

 

Open the configuration file unimrcpclient.xml, located in the configuration directory of UniMRCP and specify IP addresses of the client and the server. In the following example, the Asterisk/UniMRCP client is located on 10.0.0.1 and the UniMRCP server is on 10.0.0.2.

 

<properties>

<!--  <ip type="auto"/> -->

 

<ip>10.0.0.1</ip>

<server-ip>10.0.0.2</server-ip>

</properties>

 

2.3      Usage Examples

Make use of a built-in speech grammar transcribe for recognition, having no speech contexts defined, by adding the following entries in the Asterisk configuration file extensions.conf.

 

[sample-speech-transcription-1]

exten => s,1,Answer()

exten => s,2,SpeechCreate()

exten => s,3,SpeechActivateGrammar(builtin:speech/transcribe)

exten => s,4,SpeechBackground(beep, 20)

exten => s,5,Verbose(1, "Recognition result count: ${SPEECH(results)}")

exten => s,6,GotoIf($["${SPEECH(results)}" = "0"]?7:9)

exten => s,7,Playback(error)

exten => s,8,Goto(3)

exten => s,9,Verbose(1, "Recognition result: ${SPEECH_TEXT(0)}, confidence score: ${SPEECH_SCORE(0)}, grammar-uri: ${SPEECH_GRAMMAR(0)}")

exten => s,10,SpeechDestroy()

exten => s,11,Hangup()

 

In the Asterisk dialplan, associate the provided sample to an extension, for example, 700.

 

exten => 700,1,Goto(sample-speech-transcription-1,s,1)

 

Place a test call and make sure recognition works as expected.

 

Note that in order to support the provided use-case, the module res_speech_unimrcp.so must either be checked out from the latest source or have the following change applied over the latest release 1.4.0.

 

https://github.com/unispeech/asterisk-unimrcp/commit/08a9063

 

3       Suite of UniMRCP Applications

3.1      Overview

The module app_unimrcp.so provides a suite of speech recognition and synthesis applications for Asterisk.

3.2      Configuration Steps

This section outlines major configuration steps required for use of the module app_unimrcp.so with the UniMRCP server.

 

Open the configuration file mrcp.conf, located in the configuration directory of Asterisk, and add two profiles for MRCPv2 and MRCPv1 respectively. In the following example, the Asterisk/UniMRCP client is located on 10.0.0.1 and the UniMRCP server is on 10.0.0.2.

 

[uni2]

; MRCP settings

version = 2

;

; SIP settings

server-ip = 10.0.0.2

server-port = 8060

; SIP user agent

client-ip = 10.0.0.1

client-port = 25097

sip-transport = udp

;

; RTP factory

rtp-ip = 10.0.0.1

rtp-port-min = 28000

rtp-port-max = 29000

;

; Jitter buffer settings

playout-delay = 50

max-playout-delay = 200

; RTP settings

ptime = 20

codecs = PCMU PCMA L16/96/8000 telephone-event/101/8000

; RTCP settings

rtcp = 0

 

 

[uni1]

; MRCP settings

version = 1

;

; RTSP settings

server-ip = 10.0.0.2

server-port = 1554

resource-location = media

speechsynth = speechsynthesizer

speechrecog = speechrecognizer;

;

; RTP factory

rtp-ip = 10.0.0.1

rtp-port-min = 27000

rtp-port-max = 28000

;

; Jitter buffer settings

playout-delay = 50

max-playout-delay = 200

; RTP settings

ptime = 20

codecs = PCMU PCMA L16/96/8000 telephone-event/101/8000

; RTCP settings

rtcp = 0

 

3.3      Usage Examples

Make use of a built-in speech grammar transcribe for recognition, having no speech contexts defined, by adding the following entries in the Asterisk configuration file extensions.conf.

 

[sample-speech-transcription-2]

exten => s,1,Answer

exten => s,2,MRCPRecog("builtin:speech/transcribe", spl=en-US&f=beep&p=uni2)

exten => s,3,Goto(mrcprecog-output,s,1)

 

Note the macro mrcprecog-output, used in the example above, is defined in the file mrcp_sample_apps.conf.

 

In the Asterisk dialplan, associate the provided sample to an extension, for example, 800.

 

exten => 800,1,Goto(sample-speech-transcription-2,s,1)

 

Place a test call and make sure recognition works as expected.