- Сделать исходящий звонок.
< li>Воспроизводить аудиофайл во время разговора. - Переадресовать вызов на другой номер, если пользователь нажмет «1».< /p>
'' . $forwardNumber . '']
);
echo "Call forwarded to " . $forwardNumber;
} catch (Exception $e) {
echo "Error while forwarding the call: " . $e->getMessage();
}
} else {
echo "No action for this digit.";
}
// Respond with an empty TwiML to end the gather
header('Content-Type: text/xml');
echo '';
echo '';
exit;
}
// Handle POST requests
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['action'])) {
switch ($_POST['action']) {
case 'start_calling':
startCalling();
break;
case 'handle_key_press':
handleKeyPress();
break;
}
}
}
// Handle GET requests for serving TwiML
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['action'])) {
if ($_GET['action'] === 'serve_twiml') {
serveTwiml();
}
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... rror-12100
Мобильная версия