I am trying to play a sound through a conversation with Twilio. I am new to Twilio and I am running into some problems.
The call is initiated from a mobile application using the Twilio Client SDK plugin. In the Twilio console I have created a TwiML app, and have set the Request URL.
This is my TwiML code.
What I want:
- The user initiates the call from the app.
- The user gets a time limit (set in the TwiML on my server).
- The call is connected with a number on the PSTN.
- When the time limit is almost reached, a sound must be played to notify the user that the call will be ended soon. (Example: Time limit is 1 minute, 30 seconds into the call a sound plays)
- The call is ended when the limit is reached.
I can already end the call when the time limit is reached but can't figure out how to notify the user.
What I have tried:
I have specified a Status Callback URL in the TwiML app, and I wanted to modify the call state from there, but the Status Callback is only called after the call has finished. This was based on this post.
I have tried to create a Conference based on this post, but I can't get it to work. I think because I am not using the REST API. I am initiating the call from the mobile app using the Client SDK. Should I use the REST API and how would I implement it in combination with the Client?
Server side I use PHP.
If more information is needed, please let me know!