FreePBX 13.0.188.9
Asterisk 13.7.2
Dialplan:
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 'https://somewebsite.com/bcms' | python -c "import sys, json; print json.load(sys.stdin)['AUX']")})
exten => s,n,SayDigits(${result})
exten => s,n,Hangup
when I curl -s ‘https://somewebsite.com/bcms’ 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 ‘https://somewebsite.com/bcms’ | 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 ‘https://somewebsite.com/bcms’ | python -c "import sys, jso’?
It seems like I am missing a parentheses, but I don’t see where. Any ideas?