I am making a new program in IVR using Asterisk and php. In this program I want to play background music to users while checking checking database table frequently in asterisk. When signal comes to database table I need to perform another function. In my code I just check database using while loop and users don`t listen anything. I want to use 2 processes in parallel in asterisk-php but I cannot. Please help me.
ivr.php
while(question<10){
$agi->streamFile('ivrc/games/music_file','');
$quer = "SELECT tv_answer('" .$msisdn. "','1') AS corr";
$correct = $db2->query($quer)->row['corr'];
if($correct==10){
////Do some processes here
}
}
Here I am playing music which is 10 seconds and then check database table. But I need to check database table in every second. How can I use both of them in parallel. I read that I need to add some extensions to the asterisk.conf file. But I don`t know what to add.