andrenatal / unimrcp

Automatically exported from code.google.com/p/unimrcp
Apache License 2.0
0 stars 0 forks source link

Different behaviour of UniMRCP Client vs. Asterisk Plugin #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. on mrcpclient: run recog uni1 -> works and recognises ASR output (cmd.cap)
2. using asterisk unimrcp plugin, I get res_speech_unimrcp.c:593
uni_recog_get: Failed to load NLSML document (call.cap)
3. tcpdump of both transactions attached.

What version of the product are you using? On what operating system?

Asterisk-UniMRCP bundle 0.2 (SVN for plugin), Ubuntu 9.10

Please provide any additional information below.
I see extra bits of communication in the Asterisk version, which might be
the reason, I am rusty on my C++ side and was unable to see what data is
being returned for NLSML parsing and hence have to report this here rather
than be able to fix it myself.

Original issue reported on code.google.com by taz...@gmail.com on 14 Apr 2010 at 2:04

Attachments:

GoogleCodeExporter commented 9 years ago
It seems I understand the description of the problem right, though couldn't get 
the
same results. It works to me for both cases. I quickly used the NLSML result 
from the
network capture you attached against umc and asterisk applications and both 
behaved
the same way. See my Asterisk console output below.

ANNOUNCE rtsp://192.168.1.10:1554/media/speechrecognizer RTSP/1.0
CSeq: 4
Session: f68573bbff90d041
Content-Type: application/mrcp
Content-Length: 312

RECOGNITION-COMPLETE 3 COMPLETE MRCP/1.0
Completion-Cause: 000 success
Content-Type: application/x-nlsml
Content-Length: 181

<?xml version='1.0'?><result><interpretation grammar='digit'
confidence='85.37'><input
mode='speech'>...</input><instance><answer>Masr</answer></instance></interpretat
ion>
</result>

[Apr 15 04:02:58] NOTICE[7351]: res_speech_unimrcp.c:569 uni_recog_get: Get 
result
'f68573bbff90d041'
[Apr 15 04:02:58] NOTICE[7351]: res_speech_unimrcp.c:634 uni_recog_get: 
Interpreted
input:... score:85 grammar:none

I'd suggest you put a few traces in nlsml_doc_load located in apt_nlsmsl_doc.c.
Also, just wonder if you use proper APR and APR-Util libs in both cases. Note 
that
Ubuntu comes with its own APR libraries.

Original comment by achalo...@gmail.com on 14 Apr 2010 at 7:18

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks achaloyan for your prompt response. As I mentioned my C/C++ is a bit 
rusty,
can you please guide me how can I ast_log the whole body text on which 
nlsml_doc_load
works? In the trace I see the extra define grammar after the nlsml result which 
is
weird and I do not see that when using the command line.

I am more suspicious about the libmrcp*.so libs because although the mrcpclient
executable displays 0.10, and I can compile the asterisk plugin with it, I can 
not
load that plugin because I get symbol not found for
mrcp_client_connection_timeout_set I checked ldconfig -v and updatedb/locate 
and the
libs seem to be ok, unless I am missing something.

Original comment by taz...@gmail.com on 16 Apr 2010 at 7:18

GoogleCodeExporter commented 9 years ago
OK, now able to display the ->buf, and it looks ok to me, so now I am puzzled 
why the
result was not interpreted:

[Apr 16 17:10:16] WARNING[14779]: res_speech_unimrcp.c:593 uni_recog_get: 
Failed to
load NLSML document: <?xml version='1.0'?><result><interpretation 
grammar='digit'
confidence='80.22'><input
mode='speech'>���</input><instance><answer>Masr</answer></instance></inter
pretation>
</result>

Original comment by taz...@gmail.com on 16 Apr 2010 at 12:12

GoogleCodeExporter commented 9 years ago
I suspect you linked against wrong libraries.
To help you out a bit, I've added a few traces in NLSML document loader.
See r1655 and apply the modified source file (apt_nlsml_doc.c) or the diff over 
the
version you're using and check the output.

Original comment by achalo...@gmail.com on 16 Apr 2010 at 6:42

GoogleCodeExporter commented 9 years ago
Thanks a lot for your help with the traces, unfortunately the first one failed:

Failed to feed NLSML input to the parser

Well with the weekend already here, I had to do an ugly hack to get it working 
for
the demo. I was using Ubuntu because that is my desktop OS, on servers I use 
CentOS
so I have high hopes not to get into these Library issues on it, otherwise will 
keep
using my hack if it still does not work:

    char *tmp1;
    char *tmp2;
    char *buf  = strdup(nlsml_result->buf);

    tmp1 = strstr( buf, "grammar='" );
    tmp1 += 9;
    tmp2 = strstr( tmp1, "'" );
    int idx = (tmp2-tmp1);
    strncpy( tmp2, tmp1, idx );
    tmp2[idx] = '\0';
    speech->results->grammar = strdup(tmp2);

    buf  = strdup(nlsml_result->buf);
    tmp1 = strstr( buf, "confidence='" );
    tmp1 += 12;
    tmp2 = strstr( tmp1, "'" );
    idx = (tmp2-tmp1);
    strncpy( tmp2, tmp1, idx );
    tmp2[idx] = '\0';
    speech->results->score = atoi(tmp2);

    buf  = strdup(nlsml_result->buf);
    tmp1 = strstr( buf, "<answer>" );
    tmp1 += 8;
    tmp2 = strstr( tmp1, "</answer>" );
    idx = (tmp2-tmp1);
    strncpy( tmp2, tmp1, idx );
    tmp2[idx] = '\0';
    speech->results->text = strdup(tmp2);

Original comment by taz...@gmail.com on 17 Apr 2010 at 4:59

GoogleCodeExporter commented 9 years ago
Have you managed to workaround this issue?

Original comment by achalo...@gmail.com on 27 Apr 2010 at 1:10

GoogleCodeExporter commented 9 years ago
I am using the code above, so instead of parsing it the proper way I am just 
getting
the info I require into the structure and return, hence bypassing the library 
causing
problems.

Thanks for your concerns though.

Original comment by taz...@gmail.com on 27 Apr 2010 at 1:37

GoogleCodeExporter commented 9 years ago
This issue remains a bit strange to me. I'd suggest to use ldd to check whether 
both
UniMRCP client application and Asterisk module are using the same libraries. The
libraries to check are apr, apr-util and expat

ldd ldd /usr/local/unimrcp/lib/libunimrcpclient.so
ldd /usr/lib/asterisk/modules/res_speech_unimrcp.so

Original comment by achalo...@gmail.com on 5 May 2010 at 5:27

GoogleCodeExporter commented 9 years ago
As far as I still have no clue what was wrong there, and you have found a 
workaround,
I'm going to close this issue.
Feel free to re-open, if you have an update.

Original comment by achalo...@gmail.com on 12 May 2010 at 5:40