问题
Based off of this question, it's so close to what I want.
We're trying to have the Say verb trigger DURING the phone call, when both parties have established connections. Not before pickup, not after hangup, not during client ringing.
<?php
header('Content-type: text/xml');
?>
<Response>
<Dial callerId="+[some number]" record="true">
<Number url="say.php">
<?php echo htmlspecialchars($_REQUEST["tocall"]); ?>
</Number>
</Dial>
</Response>
And say.php..
<?php
header('Content-type: text/xml');
?>
<Response>
<Say voice="man" language="en">Long sentence to test quality of call over duration of [time]</Say>
</Response>
As you can see, we're doing this to test the quality of a call over the duration of 2 hours, so ignore what it's actually "say"ing.
What do I have to do to make this say verb trigger during a connected phone call, and not any of the pre/post stage call process?
回答1:
Twilio employee here. This is a multi-step process:
1) Connect the call between person A and person B as you have already done. Make sure to specify a status callback URL that points to your webapp.
2) When Twilio calls this URL and passes the status of in-progress you know the call is live.
3) Now use the REST API to modify the live call and inject your TwiML.
That should do it.
来源:https://stackoverflow.com/questions/26597496/twilio-say-verb-during-a-phone-call