Answer the question
In order to leave comments, you need to log in
How to make php async?
Question to those who know and fumbles.
My task is to make it possible to interrupt the recording, that is, if I launch Playback in PHP AGI, then the script waits until the recording is played and goes on, but I need to check every second, through speechkit, what the person said something or not. If it says, then you need to abort playback and run another script.
The problem, as I said, is that only 1 function is executed, not two at once.
Through what can this be done? They advised sockets, but never worked with them, maybe they are not relevant here.
Answer the question
In order to leave comments, you need to log in
Solved the problem like this:
$pid = pcntl_fork();
if ($pid == -1) {
die('Не удалось породить дочерний процесс');
} else if ($pid) {
// код первой функции
pcntl_wait($status); // Защита против дочерних "Зомби"-процессов
} else {
// код второй функции
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question