Trubles with CURL

Asterisk 14.7.5, FreePBX
Hi there!

I’ve got a problem

Then i insert the lines in the beginig of context “macro-dial”
exten => s,1,SET(CURL_RESULT=${CURL(http:/mycrm/rest/userstate)}) – my line
exten => s,n,GotoIf($["${CURL_RESULT}" = “No”]?NOANSWER,1) – my line
exten => s,n,Noop(Blind Transfer: ${BLINDTRANSFER}, Attended Transfer: ${ATTENDEDTRANSFER}, User: ${AMPUSER}, Alert Info: ${ALERT_INFO})
exten => s,n,ExecIf($["${ALERT_INFO}"="" & ${LEN(${AMPUSER})}!=0 & ${LEN(${BLINDTRANSFER})}=0 & ${LEN(${ATTENDEDTRANSFER})}=0]?Set(ALERT_INFO=))
exten => s,n,ExecIf($[${LEN(${BLINDTRANSFER})}!=0]?Set(ALERT_INFO=))

I’m getting serius CPU utilisation and voice distutrion, then total simulanius calls amount 40-50.

I’ve tryed like this
exten => s,1,AGI(crm.php,userstate)
exten => s,n,GotoIf($["${CURL_RESULT}" = “No”]?NOANSWER,1)

or like this
exten => s,1,System(${AMPBIN}/crm.php “userstate”)
exten => s,n,GotoIf($["${CURL_RESULT}" = “No”]?NOANSWER,1)

And got same result like with CURL function.

But if
exten => s,1,System(${AMPBIN}/crm.php “userstate”&)
exten => s,n,GotoIf($["${CURL_RESULT}" = “No”]?NOANSWER,1)

there are no CPU utilisatoin, like a results.

Anyone know why is this happened? Or what i’ve should to chek, and how can i do that?

Have you run htop during the issues to see what processes are taking up your resources?

In this example, you send the curl request to the background, & , in effect ‘forking’ , so not ‘blocking’ , whether you proceed in the dialplan ‘correctly’ is doubtful.

Methods of properly calling external processes is discussed here

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.