[unispeech/asterisk-unimrcp] 04a6ad: Extended RECOG_INSTANCE() to optionally return ind...

1 view
Skip to first unread message

Arsen Chaloyan

Dec 8, 2020, 8:30:38 PM12/8/20
to unimrcp...@googlegroups.com
Branch: refs/heads/master
Home: https://github.com/unispeech/asterisk-unimrcp
Commit: 04a6adc5c61f5947ef3e5afd5368065d749e9404
Author: Arsen Chaloyan <acha...@gmail.com>
Date: 2020-12-08 (Tue, 08 Dec 2020)

Changed paths:
M app-unimrcp/app_datastore.c
M app-unimrcp/app_datastore.h
M app-unimrcp/app_mrcprecog.c
M app-unimrcp/app_synthandrecog.c
M include/ast_compat_defs.h

Log Message:
Extended RECOG_INSTANCE() to optionally return individual fields of the <instance> element represented in JSON.

The NLSML instance format is suppose dto be indicated by a new option 'nit' passed to MRCPRecog() and SynthAndRecog(). The option can be set either to 'xml' (default) or 'json'.

Let's observe the following data structure as an example.

"queryText": "Sunnyvale",
"action": "room.reservation",
"parameters": {
"duration": "",
"time": "",
"location": {
"shortcut": "",
"country": "",
"street-address": "",
"admin-area": "",
"island": "",
"city": "Sunnyvale",
"subadmin-area": "",
"business-name": "",
"zip-code": ""
}, "date": ""
"fulfillmentText": "What date?",
"fulfillmentMessages": [
"text": {
"text": [
What date?"

RECOG_INSTANCE(0/0) returns the inner content of the <instance> element as before.
RECOG_INSTANCE(0/0/fulfillmentText) results in "What date?".
RECOG_INSTANCE(0/0/parameters/location/city) results in "Sunnyvale".
RECOG_INSTANCE(0/0/fulfillmentMessages) results in [{"text": {"text": [What date?"]}}].
RECOG_INSTANCE(0/0/fulfillmentMessages/0/text) results in {"text": [What date?"]}.
RECOG_INSTANCE(0/0/fulfillmentMessages/0/text/text/0) results in "What date?".

Reply all
Reply to author
0 new messages