jquery, rest api, return status failed net::ERR_NETWORK_CHANGED
Я делаю анисхронный запрос на API, который должен сделать звонок
но в ответ получаю ошибку failed net::ERR_NETWORK_CHANGED
Что это может быть и как решить эту проблему?
if (phoneCallResponse.code === 'success') {
jQuery('.phone-call-info-text').text('Your call is being connected to a recovery advisor. Please hold.');
jQuery('#call-timer-button').hide();
jQuery('#no-answer-buttons').hide();
clearInterval(myTimer);
let showAdvisor = true;
const refreshId = setInterval(async function () {
const result = await request(apiRequests.dataPickupPhone,
{
'token': phoneCallResponse.message.token,
'showAdvisor': showAdvisor
}, "GET");
if (result.message.status === 'DECLINED_CALL' || result.message.status === 'ACTIVE_CALL_USER_HANG_UP' || result.message.status === 'QUEUE_USER_HANG_UP') {
hideTimer();
clearInterval(refreshId);
}
if (result.message.status === 'CONNECTED_TO_MANAGER') {
if (result.message.managerName) {
managerData.managerExt = result.message.et;
managerData.managerName = result.message.managerName;
managerData.managerUrl = result.message.url;
managerData.managerEmail = result.message.email1;
managerData.managerPhone = result.message.phone;
}
if (typeof managerData.managerName !== 'undefined' && showAdvisor === true) {
jQuery('.phone-call-consultant-image').addClass('active');
jQuery('#new-steps-form').find('.consultation-img').attr('src', managerData.managerUrl);
jQuery('.phone-call-info-text').text('');
jQuery('.phone-call-info-text').append('You are now speaking with a recovery advisor: ' + managerData.managerName + '<br>'
+ 'Direct Phone: ' + managerData.managerPhone + '<br>'
+ 'Email:' + managerData.managerEmail);
showAdvisor = false;
} else {
if (showAdvisor === true) {
jQuery('.phone-call-info-text').text('You are now speaking with a recovery advisor.');
showAdvisor = false;
}
}
}
}, 3000);
}else{
jQuery('#no-answer-buttons').show();
clearInterval(myTimer);
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_TIMEOUT => 30,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $json,
CURLOPT_HTTPHEADER => array(
'x-salvagedata-api-key: ju8123u8hndsabh231iy7ewygufba89g71uy',
'Content-Type: application/json'
),
));
$result = curl_exec($curl);
if ($pickupPhone = curl_exec($curl) !== false) {
$result = json_decode($result);
if (!empty($result) AND $result->success === true AND is_null($result->call_exists)) {
return new WP_Error('success',
__(array('token' => $params['token']), 'rest-tutorial'),
array('status' => 200)
);
} elseif (!empty($result) AND $result->success === true AND !empty($result->call_exists) AND $result->call_exists === true) {
return new WP_Error('error',
__(array('callExist' => true), 'rest-tutorial'),
array('status' => 200)
);
} else {
return new WP_Error('error',
__(array('callFailed' => true), 'rest-tutorial'),
array('status' => 200)
);
}
}
но я получаю ошибку
https://i.stack.imgur.com/EbQ9k.png