Shell cURL+JSON in the dialplan

Asterisk 13.7.2


exten => s,1,GotoIf($["${CHANNEL(state)}" = "Up"]?begin)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(begin),Noop(Playing announcement howdy)
exten => s,n,Playback(custom/howdyhowdyhowdy)
exten => s,n,Set(result=${SHELL(curl -s '' |     python -c "import sys, json; print json.load(sys.stdin)['AUX']")})
exten => s,n,SayDigits(${result})
exten => s,n,Hangup

when I curl -s '' I get a JSON response with multiple fields. I need the value of only one field.

In the Linux command line, when I run:
curl -s '' | python -c "import sys, json; print json.load(sys.stdin)['AUX']")})
It works. Linux returns a number result (e.g. 10)

When I try to bake that into the dial plan I get an error:

[2016-10-26 15:40:36] WARNING[13399][C-00002c77]: pbx.c:4771 pbx_substitute_variables_helper_full: Error in extension logic (missing '}')
[2016-10-26 15:40:36] WARNING[13399][C-00002c77]: pbx.c:4274 func_args: Can't find trailing parenthesis for function 'SHELL(curl -s '' | python -c "import sys, jso'?

I think this is related to the new line clause. I read the example on the wiki, but I am not sure how to string this together. Can anyone help me by providing an example using the info above? Thanks for your help!

The ; is being treated as a comment indicator. You will need to escape it by putting \ in front of it.