[Freeswitch-users] Lua XML parser

Glen Ganderton Glen.Ganderton at premier.com.au
Mon Sep 12 10:26:34 MSD 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110912/67338f2c/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list