I discuss basic pattern matching in Lua in chapter 7 of our book. I'm thinking you'll need to do something like this. Assume that variable "nuance_res" contains the blurb that you posted below.
Hey Guys,
I’m currently trying to create a basic IVR with voice recognition (just a simple YES or NO response). I have successfully configured the freeswitch MRCP client to connect to my nuance MRCP server and I successfully get a responses from the server. Now what I need to do is process the response in my freeswitch lua script. The nuance box returns the following:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Completion-Cause: 000 success
Content-Type: application/nlsml+xml
Content-Length: 178
<?xml version='1.0'?><result><interpretation grammar="session:nuance5-mrcp2" confidence="0.99"><input mode="speech">yes</input><instance>true</instance></interpretation></result>
Now what I want to be able to do is parse the XML in my lua script so that I can simply have the XML stored in some variables:
Eg.
Confidence = 0.99
Input = yes
Instance = true
….etc.
I am just starting to learn lua and am unable to do this myself. I have seen a few scripts online to parse XML for lua but none seem to work correctly (maybe they are meant for different format..not sure).
If anybody could point me in the right direction or write some sample code for what I need to do that would be a great help.
Thanks in advance.
-Glen
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org