PreAnswer
Definition
The PreAnswer
verb responds to the incoming call before it is answered. This is a so called early media mode: the media is sent to the calling party before the called party answers the call. This is especially useful when you want to play some custom message (e.g., to warn the calling party about some additional costs) so that they could hang up before the conversation actually starts.
You can also use the PreAnswer
to set custom ringtones or to speak specified text dynamically while the call is still in an unanswered state.
Not all phone numbers support the early media mode. It is not a part of the WebRTC specification, so the phones based on it will fail to playback the content nested inside the PreAnswer
verb.
Example
In this example an automatic 'Sorry, we cannot answer your call right now. Please try again later.' message will be played to the calling party and then, after a 4-second pause, a pre-recorded message will be repeated three times. Then the call will be rejected.
<Response>
<PreAnswer>
<Say>Sorry, we cannot answer your call right now. Please try again later.</Say>
<Pause length="4"></Pause>
<Play loop="3">https://storage.carrierx.com/f/5fac56c8-c9fa-4d0e-bf88-f114e0d0cfab.mp3</Play>
</PreAnswer>
<Reject reason="busy"></Reject>
</Response>