I have an ASP.NET Core 2 application and I'm trying to forward a call made to a Twilio number to another number. When I try to return TwiML
I get an error that says:
"Non-invocable member 'TwiML' cannot be used like a method."
Here's the method:
[HttpPost]
public TwiMLResult ForwardCall(string called)
{
var response = new VoiceResponse();
response.Dial(newNumber);
return TwiML(response);
}
The error happens here:
return TwiML(response);
All the code examples I've seen tell me to return the TwiML
this way but for some reason, I'm unable to.
The problem was that the controller was not inheriting from TwilioController. Once I had my controller inherit from TwilioController the error went away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With