I am playing with dsm, trying to extract JSON from a string.
Unless there is an easier way of doing it, I'm using the regex mod to try and
extract the value out by doing this:
$curl.out =
'{"state":"INITIAL","enter_uri":"","default_uri":"","hangup_uri":"","connection":[{"uri":"19055551234"}],"server":"","connection_type":"SERIAL","connection_timeout":30,"timeout_uri":"","connect_uri":"","busy_uri":""}'
regex.compile(state,"\"state\"\:[^\,\}]*")
regex.match(state,$curl.out)
log(2,$regex.match)
log(2,$regex.match[1])
I get this in the logs:
[#7fb1a3e68700/16207] [runactions, DSMStateEngine.cpp:321] DEBUG: executing
'log(2,$regex.match)'
[#7fb1a3e68700/16207] [execute, DSMCoreModule.cpp:613] INFO: FSM: $regex.match
'1'
[#7fb1a3e68700/16207] [runactions, DSMStateEngine.cpp:321] DEBUG: executing
'log(2,$regex.match[1])'
[#7fb1a3e68700/16207] [execute, DSMCoreModule.cpp:613] INFO: FSM:
$regex.match[1] ''
So it seems to find the regex, but I can't get it to print it out.
Any ideas?
Thanks!
Derrick
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems