Hi guys!
I need parse curl result in my dialplan, and I have problem:
My dialplan:
[sub-ASRTEST]
exten => s,1,Noop(-------------------------------------------------------------ASR TEST -----------------------------)
same => n,Set(SR-FILENAME=/tmp/SR-${CALLERID(num)}-${UNIQUEID}.wav)
same => n,Record(${SR-FILENAME},3,30)
same => n,Noop(--------------------Test -----------------------------)
same => n,Set(wynik=${SHELL(curl -X POST "http://someweb.some.pl:9000/upload" -H "accept:application/json" -H "Content-Type: multipart/form-data" -F "[email protected]${SR-FILENAME};type=audio/wav")})
same => n,NoOp(result is ${wynik})
same => n,noop(----------------------------------------------------------------------------------------------)
same => n,Return
When I execute curl in system shell âcurl -X POST âhttp://someweb.some.pl:9000/uploadâ -H âaccept:application/jsonâ -H âContent-Type: multipart/form-dataâ -F â[email protected]${SR-FILENAME};type=audio/wavââ
I got answer:
{âfileâ:âSR-100-1677604067.5.wavâ,âmessageâ:âSUCCESSâ,âtranscriptâ:[{âend_in_sâ:4.0,âstart_in_sâ:0.0,âtextâ:" Hello my name is Paul."}]}
But from dialplan, I receive error like that:
[2023-03-01 12:45:01] WARNING[21872][C-00000025]: pbx_variables.c:756 pbx_substitute_variables_helper_full_location: Error in extension logic (missing â}â)
[2023-03-01 12:45:01] WARNING[21872][C-00000025]: pbx_functions.c:460 func_args: Canât find trailing parenthesis for function âSHELL(curl -X POST âhttp://someweb.some.pl:9000/uploadâ -H âaccept:application/jsonâ -H âContent-Type: multipart/form-dataâ -F "[email protected]/tmp/SR-100-1677671090.36.wavâ?
I found similar topic here: [SHELL + cURL In Dialplan - #3 by comtech]
But those solution doesnât work.