Agi can not get xml variable

hi, recently i doing asr test.
i use agi in java .

here is java agi:
String prompt = “welcome,please say something”;
String welcomeIVR = prompt + “,builtin:grammar/number,t=5000&b=1&ct=0.7&spl=zh-CN”;
channel.exec(“SynthAndRecog”, welcomeIVR);

    	String status = channel.getVariable("RECOG_STATUS");
    	System.out.println("status:" +status );
    	String result = channel.getVariable("RECOG_RESULT");
    	System.out.println("result:" + result );

the console result is below:

but asterisk cli output line print result like:
[2019-08-07 15:42:26] VERBOSE[19017][C-00078f29] app_verbose.c:

<?xml version="1.0" encoding="UTF-8" ?>
     <asr confidence="100">hello</asr>

why java agi can not get the variable?

any good idea?
or please give something to list

can someone help me ?

The SynthAndRecog sounds fun ! I’ve not seen it, but it might be where your problem is. However, if you could modify that application, then you might be able to change the output of what gets saved into the RECOG_RESULT return variable or even add additional return variables such as RECOG_CONFIDENCE, RECOG_TEXT, RECOG_LOGID which Asterisk could then handle via standard dial plan configuration.

Also, what does the line you see on Asterisk CLI look like in your dial plan configuration … the specific Verbose() application call path that produces the XML you posted ?

the specific Verbose() application call path the XML .
the return result use NLSML format.
dialplan is :
exten => s,n(s1),Verbose(1, {RECOG_STATUS}, {RECOG_COMPLETION_CAUSE}, ${RECOG_RESULT})

the verbose is :

VERBOSE[9637][C-00001800] pbx.c:     -- Executing [s@synthandrecog-app1:3] Verbose("SIP/z_line_in-00002293", "1, OK, 000, <?xml version="1.0" encoding="UTF-8" ?>
    -- <result>
    --     <asr confidence="100">machael</asr>
    --     <ext>
    --         <logid>8b3b3cbcd51111e9_0</logid>
    --     </ext>
    -- </result>
    -- ") in new stack

i also add var above,but nothing display.

Those were suggestions for new variables to consider. They (probably) don’t exist yet. But, I’ve got no idea what is happening in your SynthAndRecog application. Is that a third-party C module you’ve added to standard Asterisk ? Can you share the source for it ?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.