asterisk /unimrcp/nuance voice recognizer passing parameters to a grammar

258 views
Skip to first unread message

David T.

unread,
May 11, 2015, 5:31:23 PM5/11/15
to uni...@googlegroups.com
hello,
Loading and activating a grammar from asterisk works well using Speechloadgrammar and speechactivategrammar when not passing any variable (parameter) to the grammar
Has anyone tried to pass variables from asterisk through unimrcp to a grammar used by nuance recognizer.
Normaly, parameters can be passed in the following manner:
path/to/mygrammar.xml?SWI_vars.var1=var1value.
but how does it work from asterisk?
Is it done upon loading the grammar or activating it? what is the correct syntax ?
I tried many combinations of load/activate syntax but could not manage to make it work. I get a bad URI answer from nuance.
Thanks

Arsen Chaloyan

unread,
May 13, 2015, 4:29:20 PM5/13/15
to UniMRCP
Hello David,

You can explicitly specify a given input parameter to SpeechLoadGrammar() being a URI by means of the corresponding prefix "uri:". In such a case, the prefix is stripped off and the specified URI is transparently passed to the server, including the query parameters. For example:

SpeechLoadGrammar(grammar-name, uri:http://host/mygrammar.xml?SWI_vars.var1=var1value)

or

SpeechLoadGrammar(grammar-name, uri:file:///path/to/mygrammar.xml?SWI_vars.var1=var1value)



--
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



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

David Taieb

unread,
May 13, 2015, 5:10:56 PM5/13/15
to uni...@googlegroups.com
Thank you Arsen,
I tried first to run it without any parameter:
Unfortunatly it does not work:
    -- [May 13 06:16:29]     -- AGI Script Executing Application: (SpeechLoadGrammar) Options: (date,uri:file:///etc/asterisk/grammars/svi/date.grxml)
[May 13 06:16:29] DEBUG[38432][C-00000000]: res_speech_unimrcp.c:1165 uni_recog_mrcp_request_send: (RSU-0) Send MRCP request method-id: 2
[May 13 06:16:29] DEBUG[38432][C-00000000]: res_speech_unimrcp.c:1169 uni_recog_mrcp_request_send: (RSU-0) Wait for MRCP response
[May 13 06:16:29] DEBUG[38423]: res_speech_unimrcp.c:921 on_message_receive: (RSU-0) Received MRCP response method-id: 2 status-code: 407 req-state: 0
[May 13 06:16:29] DEBUG[38432][C-00000000]: res_speech_unimrcp.c:1178 uni_recog_mrcp_request_send: (RSU-0) Process MRCP response method-id: 2 status-code: 407
[May 13 06:16:29] WARNING[38432][C-00000000]: res_speech_unimrcp.c:1185 uni_recog_mrcp_request_send: (RSU-0) MRCP request failed method-id: 2 status-code: 407
[May 13 06:16:29] WARNING[38432][C-00000000]: res_speech_unimrcp.c:470 uni_recog_load_grammar: (RSU-0) Failed to load grammar



but this works:
    -- [May 13 06:21:58]     -- AGI Script Executing Application: (SpeechLoadGrammar) Options: (date,/etc/asterisk/grammars/svi/date.grxml)
[May 13 06:21:58] DEBUG[38529][C-00000000]: res_speech_unimrcp.c:1165 uni_recog_mrcp_request_send: (RSU-0) Send MRCP request method-id: 2
[May 13 06:21:58] DEBUG[38529][C-00000000]: res_speech_unimrcp.c:1169 uni_recog_mrcp_request_send: (RSU-0) Wait for MRCP response
[May 13 06:21:58] DEBUG[38521]: res_speech_unimrcp.c:921 on_message_receive: (RSU-0) Received MRCP response method-id: 2 status-code: 200 req-state: 0
[May 13 06:21:58] DEBUG[38529][C-00000000]: res_speech_unimrcp.c:1178 uni_recog_mrcp_request_send: (RSU-0) Process MRCP response method-id: 2 status-code: 200

so I am a little confused here.any idea?

Arsen Chaloyan

unread,
May 13, 2015, 11:06:38 PM5/13/15
to UniMRCP
There is a key difference between the two options you tried.

1) Grammar reference by URI
AGI Script Executing Application: (SpeechLoadGrammar) Options: (date,uri:file:///etc/asterisk/grammars/svi/date.grxml)

The URI "file:///etc/asterisk/grammars/svi/date.grxml" is passed to the server, and it is up to the server to fetch the content of the specified grammar. I'm afraid the file is not accessible from the server in your case, and that's why you got the error.

2) Inline grammar
AGI Script Executing Application: (SpeechLoadGrammar) Options: (date,/etc/asterisk/grammars/svi/date.grxml)

The grammar is loaded by the MRCP client (Asterisk) with its content passed to the server inline in the DEFINE-GRAMMAR request. All is good, but this method is not suitable for query parameters you are looking for.

Bottom line: make sure the server can access grammars by URI or use a different approach.

David Taieb

unread,
May 14, 2015, 12:12:11 PM5/14/15
to uni...@googlegroups.com
Arsen,
Thank you SO much the "uri:" syntax and explaining where grammars can reside which resolved it all.
Is that keyword "uri:" part of the undocumented/underground information or is there an important document I've overlooked?
If not, I would copy/paste your email somewhere in the docs as it will save others time and headaches...

Arsen Chaloyan

unread,
May 22, 2015, 9:40:07 PM5/22/15
to UniMRCP
Glad it helped, David.

While this sort of details may unfortunately not always be available in the docs, source code is the ultimate reference.

Future of legacy wiki pages and documentation in general is subject to a separate discussion, which I'd start when the migration from Google Code will have been completed.

pdeschen

unread,
May 28, 2015, 5:39:32 PM5/28/15
to uni...@googlegroups.com


On Friday, May 22, 2015 at 9:40:07 PM UTC-4, Arsen Chaloyan wrote:
Glad it helped, David.

While this sort of details may unfortunately not always be available in the docs, source code is the ultimate reference.

Future of legacy wiki pages and documentation in general is subject to a separate discussion, which I'd start when the migration from Google Code will have been completed.


Possibly another point in favour of github, from github, wiki is in itself a git repositrory which can be cloned and contributed to [1]. Just append  .wiki.git to the git repo url. 

That may help boost community contribution.

Pascal

Arsen Chaloyan

unread,
May 29, 2015, 10:57:22 PM5/29/15
to UniMRCP
Well, I am still not ready for the move but we are heading to github, at least this is what the poll results point to. Curious to notice the difference in community contributions.

--
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages