1 post / 0 new
aponnath
aponnath's picture
Joined: 2014/02/26
Points: 0

I am wondering if anyone has used a RESTApi call via curl in a ThirdLane dial plan and then parsed the result into variables. So far i have had limited success as some of the libary's require to be compiled into the asterisk kernel and i dont want to touch that if i dont have to for now.

I tried something like this using jq but not much luck, my curl works

exten => s,n,NoOp('This is called before we call block section')
exten => s,n,NoOp(${CALLER_NUMBER})
exten => s,n,NoOp(${CALLEE_NUMBER})
exten => s,n,Set(CURL_RESULT=${CURL(http://192.168.1.100/blacklist/${CALLEE_NUMBER}/${CALLER_NUMBER})})
exten => s,n,Set(result=${SHELL(echo '${CURL_RESULT}' | jq '.status')})
exten => s,n,NoOp(${result})