Is there a way to use the Dial
verb in conjunction with the IfMachine
parameter? I don't see anything on the dial verb page (https://www.twilio.com/docs/api/twiml/dial) which indicates the IfMachine
parameter can be used or whether it will be passed to the resulting Action parameter.
I found this post Detecting if an answering service picks up, and the answer says "put the IfMachine parameter in your TwiML", but I don't see any examples of the IfMachine
parameter being used in TwiML. I've only seen examples of it being used with the REST API.
I'm trying to have my application redirect a call, then if that redirected call was picked up by an answering machine to then send a text message. Ideally the incoming call TwiML would look something like:
<Response>
<Dial action="/sendSmsIfMachine.cshtml" method="POST" ifMachine="Continue">
555-5555
</Dial>
</Response>
Then my sendSmsIfMachine page would have something like:
@{
Response.ContentType = "text/xml";
if(Response["AnsweredBy"] == "machine")
{
var twimlResponse = new TwilioResponse();
twimlResponse.Message("You got a voicemail", new { to = "555-5556" });
Response.Write(twimlResponse.ToString();
}
}
When I tried this, the resulting request made to sendSmsIfMachine.cshtml did not include the AnsweredBy parameter according to to the Twilio log.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…