Basic Usage Question for Asterisk Dialplan Apps and Functions

167 views
Skip to first unread message

sguti...@integraccs.com

unread,
Jun 20, 2017, 1:11:39 PM6/20/17
to UniMRCP
I would like to understand more about how to apply the functions

Example:

exten=> _123,2,SpeechCreate(unimrcp)
exten=> _123,3,SpeechLoadGrammar(grammar,/usr/local/unimrcp/data/${ARG2}.xml)
exten=> _123,4,SpeechActivateGrammar(grammar)
exten=> _123,5,SpeechBackground(MYSOUND},2)
exten=> _123,6,Log(VERBOSE, RESULTS: ${SPEECH(results)} -  TYPE: ${SPEECH_GRAMMAR(0)} -  SCORE: ${SPEECH_SCORE(0)})
exten=> _123,7,SpeechDeactivateGrammar(grammar)
exten=> _123,8,SpeechUnloadGrammar(grammar)
exten=> _123,9,SpeechDestroy()


Questions:


1) Is it correct to do the following each time I want to process ASR or some of the functions as SpeechCreate should be at the beginning of the call and called upon hangup as SpeechDestroy?


2) When using UnloadGrammar this way the call is hangup with 

SpeechUnloadGrammar("SIP/1000-00000026", "grammar") in new stack
[Jun 20 18:56:53] NOTICE[5520][C-0000003a]: res_speech_unimrcp.c:488 uni_recog_unload_grammar: (RSU-45) Unload grammar name: grammar
[Jun 20 18:56:53] WARNING[5520][C-0000003a]: res_speech_unimrcp.c:1185 uni_recog_mrcp_request_send: (RSU-45) MRCP request failed method-id: 2 status-code: 407
[Jun 20 18:56:53] WARNING[5520][C-0000003a]: res_speech_unimrcp.c:513 uni_recog_unload_grammar: (RSU-45) Failed to unload grammar


any advice?

thanks

Arsen Chaloyan

unread,
Jun 20, 2017, 5:16:18 PM6/20/17
to UniMRCP
On Tue, Jun 20, 2017 at 10:11 AM, <sguti...@integraccs.com> wrote:
I would like to understand more about how to apply the functions

Sure, please see my comments below .


Example:

exten=> _123,2,SpeechCreate(unimrcp)
exten=> _123,3,SpeechLoadGrammar(grammar,/usr/local/unimrcp/data/${ARG2}.xml)
exten=> _123,4,SpeechActivateGrammar(grammar)
exten=> _123,5,SpeechBackground(MYSOUND},2)
exten=> _123,6,Log(VERBOSE, RESULTS: ${SPEECH(results)} -  TYPE: ${SPEECH_GRAMMAR(0)} -  SCORE: ${SPEECH_SCORE(0)})
exten=> _123,7,SpeechDeactivateGrammar(grammar)
exten=> _123,8,SpeechUnloadGrammar(grammar)
exten=> _123,9,SpeechDestroy()


Questions:


1) Is it correct to do the following each time I want to process ASR or some of the functions as SpeechCreate should be at the beginning of the call and called upon hangup as SpeechDestroy?

You should consider using SpeechCreate once per call before making use of any other Speech API functions. Similarly, SpeechDestroy should be the last one.

SpeechBackground is the function that performs recognition. You may invoke it as many times as you need per speech session. Depending on your requirements, you may load/unload and activate/deactivate grammar(s) just once per session or anytime before/after SpeechBackground.


2) When using UnloadGrammar this way the call is hangup with 

SpeechUnloadGrammar("SIP/1000-00000026", "grammar") in new stack
[Jun 20 18:56:53] NOTICE[5520][C-0000003a]: res_speech_unimrcp.c:488 uni_recog_unload_grammar: (RSU-45) Unload grammar name: grammar
[Jun 20 18:56:53] WARNING[5520][C-0000003a]: res_speech_unimrcp.c:1185 uni_recog_mrcp_request_send: (RSU-45) MRCP request failed method-id: 2 status-code: 407
[Jun 20 18:56:53] WARNING[5520][C-0000003a]: res_speech_unimrcp.c:513 uni_recog_unload_grammar: (RSU-45) Failed to unload grammar

What MRCP server do you use?

On other hand, you may invoke SpeechDestroy() without using SpeechDeactivateGrammar() and/or SpeechUnloadGrammar(). These functions are used in the sample app for the sake of completeness of API.


any advice?

thanks

--
You received this message because you are subscribed to the Google Groups "UniMRCP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unimrcp+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Arsen Chaloyan
Author of UniMRCP
http://www.unimrcp.org

sguti...@integraccs.com

unread,
Jun 21, 2017, 6:10:38 AM6/21/17
to UniMRCP
Thanks for the answers.

based on your comments:

1) SpeechCreate at the begging of the call
2) SpeechDestroy at hangup (h exten)
3) Loading and activating grammars to do the SpeeachBackground and after that doing deactivate grammar
4) Not using UnloadGrammar anymore.

Im using VERBIO.

is that ok? or loading same grammar without unloading may cause an issue? beacuse I'm using a GOSUB that is doing Loading -> Activating -> SpeechBackground -> Deactivating. many times

or is it better to Destroy and Create each time?

thanks



any advice?

thanks
To unsubscribe from this group and stop receiving emails from it, send an email to unimrcp+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Arsen Chaloyan

unread,
Jun 21, 2017, 5:25:59 PM6/21/17
to UniMRCP
On Wed, Jun 21, 2017 at 3:10 AM, <sguti...@integraccs.com> wrote:
Thanks for the answers.

based on your comments:

1) SpeechCreate at the begging of the call
2) SpeechDestroy at hangup (h exten)
3) Loading and activating grammars to do the SpeeachBackground and after that doing deactivate grammar
4) Not using UnloadGrammar anymore.

Im using VERBIO.

is that ok? or loading same grammar without unloading may cause an issue? beacuse I'm using a GOSUB that is doing Loading -> Activating -> SpeechBackground -> Deactivating. many times

From the perspective of UniMRCP client and Asterisk, as well as MRCP spec itself, I do not see any problems. You may also need to check this with your MRCP server vendor to make sure there are no hidden problems like with unloading grammars.


or is it better to Destroy and Create each time?

Do not do this, unless you have to.

To unsubscribe from this group and stop receiving emails from it, send an email to unimrcp+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages