I am able to make an outgoing call with Twilio and my iOS app using the VoiceResponse object. I have a node.js app running that accepts a call request at the /makeCall endpoint.
I need to be able to send DTMF tone during the ongoing call. To test this, I created an API endpoint with the following code, and trigger it using an API client. I see the endpoint responds with the proper TwiML string, however, it has no effect on the ongoing call. Am I doing something wrong? It feels like there needs to be something that ties my call to with the ongoing call.
function pressKey(response) {
const voiceResponse = new VoiceResponse();
voiceResponse.play({
digits: "1"
});
console.log(voiceResponse.toString());
return response.send(voiceResponse.toString());
}
Twilio developer evangelist here.
You can actually play DTMF tones using the iOS Voice SDK itself using the sendDigits
method on the TVOCall object.
This will play the digits into the call. As you questioned, making an API call to your own API that returns TwiML will not have anything to do with any in progress calls because there is no interaction with Twilio at all.
Let me know if this helps at all.